This is the multi-page printable view of this section.
Click here to print .
Return to the regular view of this page .
Data Protection Endpoints
Protecting names, addresses, and other PII information
Protegrity API Playground exposes a curated selection of endpoints for data protection: you can use them to secure any PII and PCI information. The predefined endpoints include names, addresses, numbers, Credit Card Numbers, Social Security Numbers, and more. Format, length and language preservation are supported.
This collection is a subset of Protegrity functions available in the full version of the product.
1 - Name (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/name
DESCRIPTION :
Protect or unprotect a person’s name. The received token is not length-preserving.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
dictionary
(optional) Specify the Unicode domain of the input and output values. Option en
covers all characters within the Basic Latin block of the Unicode standard (range U+0000..U+007F). Options de
and fr
extend that coverage to include German and French characters, respectively. Accepts: [ en | de | fr ]
. Defaults to en
.
eiv
(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 eiv
has to be provided in the payload.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/name' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["Robin", "Wren"],
"options": {
"dictionary": "en"
}
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/name'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["Robin" , "Wren" ],
"options" : {
"dictionary" : "en"
}
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/name" );
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 = "{ \"operation\": \"protect\", \"data\": [\"Robin\", \"Wren\"], \"options\": { \"dictionary\": \"en\" } }" ;
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/name' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["Robin" , "Wren" ],
"options" : { "dictionary" : "en" }
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/name"
data := strings .NewReader (`{
"operation": "protect",
"data": ["Robin", "Wren"],
"options": {"dictionary": "en"}
}` )
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
2 - Address (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/address
DESCRIPTION :
Protect or unprotect an address. The received token is not length-preserving.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
dictionary
(optional) Specify the Unicode domain of the input and output values. Option en
covers all characters within the Basic Latin block of the Unicode standard (range U+0000..U+007F). Options de
and fr
extend that coverage to include German and French characters, respectively. Accepts: [ en | de | fr ]
. Defaults to en
.
eiv
(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 eiv
has to be provided in the payload.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/address'
--header 'x-api-key: <API_Key>'
--header 'Content-Type: application/json'
--header 'Authorization: <JWT_TOKEN>'
--data '{
"operation": "protect",
"data": ["77 Boulevard Saint-Jacques", "46 avenue de la Grande Armée"],
"options": {
"dictionary": "fr"
}
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/address'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["77 Boulevard Saint-Jacques" , "46 avenue de la Grande Armée" ],
"options" : {
"dictionary" : "fr"
}
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/address" );
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 = "{ \"operation\": \"protect\", \"data\": [\"77 Boulevard Saint-Jacques\", \"46 avenue de la Grande Armée\"], \"options\": { \"dictionary\": \"fr\" } }" ;
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/address' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["77 Boulevard Saint-Jacques" , "46 avenue de la Grande Armée" ],
"options" : { "dictionary" : "fr" }
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/address"
data := strings .NewReader (`{
"operation": "protect",
"data": ["77 Boulevard Saint-Jacques", "46 avenue de la Grande Armée"],
"options": {"dictionary": "fr"}
}` )
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
[
"3u CG5itJTNu KJStq-galulig" ,
"Gr AY5iAK k1 n8 LvIx74 ewBék"
]
3 - City (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/city
DESCRIPTION :
Protect or unprotect a town or city. The received token is not length-preserving.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
dictionary
(optional) Specify the Unicode domain of the input and output values. Option en
covers all characters within the Basic Latin block of the Unicode standard (range U+0000..U+007F). Options de
and fr
extend that coverage to include German and French characters, respectively. Accepts: [ en | de | fr ]
. Defaults to en
.
eiv
(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 eiv
has to be provided in the payload.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/city' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["Berlin", "München"],
"options": {
"dictionary": "de"
}
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/city'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["Berlin" , "München" ],
"options" : {
"dictionary" : "de"
}
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/city" );
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 = "{ \"operation\": \"protect\", \"data\": [\"Berlin\", \"München\"], \"options\": { \"dictionary\": \"de\" } }" ;
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/city' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["Berlin" , "München" ],
"options" : { "dictionary" : "de" }
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/city"
data := strings .NewReader (`{
"operation": "protect",
"data": ["Berlin", "München"],
"options": {"dictionary": "de"}
}` )
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
4 - Postcode (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/postcode
DESCRIPTION :
Protect or unprotect a postal code with digits and chatacters. The received token is case-, length-, and position-preserving but may create invalid postal codes (e.g., restricted letters).
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/postcode' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["WX90GA", "SW700"]
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/postcode'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["WX90GA" , "SW700" ]
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/postcode" );
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 = "{ \"operation\": \"protect\", \"data\": [\"WX90GA\", \"SW700\"] }" ;
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/postcode' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["WX90GA" , "SW700" ]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/postcode"
data := strings .NewReader (`{
"operation": "protect",
"data": ["WX90GA", "SW700"]
}` )
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
5 - Zipcode (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/zipcode
DESCRIPTION :
Protect or unprotect a postal code with digits only. The received token is length-preserving. The method may produce leading zeroes and invalid zipcodes (e.g., restricted digits).
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
eiv
(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 eiv
has to be provided in the payload.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/zipcode' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["29017", "28100"]
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/zipcode'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["29017" , "28100" ]
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/zipcode" );
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 = "{ \"operation\": \"protect\", \"data\": [\"29017\", \"28100\"] }" ;
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/zipcode' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["29017" , "28100" ]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/zipcode"
data := strings .NewReader (`{
"operation": "protect",
"data": ["29017", "28100"]
}` )
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
6 - Phone (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/phone
DESCRIPTION :
Protect or unprotect a phone number. The received token is length-preserving. May return leading zeroes.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
eiv
(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 eiv
has to be provided in the payload.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/phone' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["63098109", "120-99-02-10"]
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/phone'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["63098109" , "120-99-02-10" ]
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/phone" );
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 = "{ \"operation\": \"protect\", \"data\": [\"63098109\", \"120-99-02-10\"] }" ;
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/phone' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["63098109" , "120-99-02-10" ]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/phone"
data := strings .NewReader (`{
"operation": "protect",
"data": ["63098109", "120-99-02-10"]
}` )
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
[
"81176289" ,
"425-44-65-10"
]
7 - Email (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/email
DESCRIPTION :
Protect or unprotect a phone number. The received token is length-preserving. May return leading zeroes.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
eiv
(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 eiv
has to be provided in the payload.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/email' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["ava.mcconnor@acme.corp", "wren@business.com"]
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/email'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["ava.mcconnor@acme.corp" , "wren@business.com" ]
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/email" );
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 = "{ \"operation\": \"protect\", \"data\": [\"ava.mcconnor@acme.corp\", \"wren@business.com\"] }" ;
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/email' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["ava.mcconnor@acme.corp" , "wren@business.com" ]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/email"
data := strings .NewReader (`{
"operation": "protect",
"data": ["ava.mcconnor@acme.corp", "wren@business.com"]
}` )
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
[
"d3E.ui2sOks@acme.corp" ,
"6KOe@business.com"
]
8 - Date of Birth (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/dob
DESCRIPTION :
Protect or unprotect a phone number. The received token is length-preserving. May return leading zeroes.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
year
(optional) Set to true
to leave the year in the clear. Must be set to true
when unprotecting the string tokenized using this option. Accepts: [ true | false ]
. Defaults to false
.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/dob' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["1980/12/10", "1965/01/27"],
"options": {
"year": true
}
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/dob'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["1980/12/10" , "1965/01/27" ],
"options" : {
"year" : "true"
}
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/dob" );
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 = "{ \"operation\": \"protect\", \"data\": [\"1980/12/10\", \"1965/01/27\"], \"options\": { \"year\": \"true\" } }" ;
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/dob' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["1980/12/10" , "1965/01/27" ],
"options" : {
"year" : true
}
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/dob"
data := strings .NewReader (`{
"operation": "protect",
"data": ["1980/12/10", "1965/01/27"],
"options": {
"year": true
}
}` )
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
[
"1980/03/24" ,
"1965/08/11"
]
9 - National Insurance Number (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/nin
DESCRIPTION :
Protect or unprotect a National Insurance Number (UK). The returned NIN is case-, length- and position-preserving, i.e., generated letters and numbers will adhere to their original position. Note that some NIN logic, i.e. restricted letters, is not preserved.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/nin' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["QQ123456A", "KT902281F"]
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/nin'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["QQ123456A" , "KT902281F" ]
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/nin" );
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 = "{ \"operation\": \"protect\", \"data\": [\"QQ123456A\", \"KT902281F\"] }" ;
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/nin' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["QQ123456A" , "KT902281F" ]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/nin"
data := strings .NewReader (`{
"operation": "protect",
"data": ["QQ123456A", "KT902281F"]
}` )
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
[
"CD196371K" ,
"OO918451S"
]
10 - Social Security Number (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/ssn
DESCRIPTION :
Protect or unprotect a Social Security Number (US). The returned SSN is length- and format-preserving. Note that some SSN logic, i.e. restricted numbers within digit groups, is not preserved.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
eiv
(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 eiv
has to be provided in the payload.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/ssn' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["782-01-2930", "291-44-5983"]
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/ssn'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["782-01-2930" , "291-44-5983" ]
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/ssn" );
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 = "{ \"operation\": \"protect\", \"data\": [\"782-01-2930\", \"291-44-5983\"] }" ;
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/ssn' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["782-01-2930" , "291-44-5983" ]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/ssn"
data := strings .NewReader (`{
"operation": "protect",
"data": ["782-01-2930", "291-44-5983"]
}` )
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
[
"399-03-3685" ,
"389-71-6451"
]
11 - Credit Card Number (PCI DSS)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/ccn
DESCRIPTION :
Protect or unprotect a Credit Card Number. The returned CCN is not length-preserving. The endpoint accepts partial CCN protection, i.e. leaving the 8-digit BIN in the clear.
ATTRIBUTES :
data
(required) Input data to transform.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
OPTIONS :
bin
(optional) Set to true
to leave the 8-digit BIN number in the clear. Must be set to true
when unprotecting the string tokenized using this option. Accepts: [ true | false ]
. Defaults to false
.
eiv
(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 eiv
has to be provided in the payload.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/ccn'
--header 'x-api-key: <API_Key>'
--header 'Content-Type: application/json'
--header 'Authorization: <JWT_TOKEN>'
--data '{ "operation": "protect", "data": ["4321567898765432", "2376876534560987"], "options": { "bin": false } }'
import requests import json
url = 'https://api.playground.protegrity.com/v1/ccn'
headers = { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' }
data = {
"operation" : "protect" ,
"data" : ["4321567898765432" , "2376876534560987" ],
"options" : {
"bin" : false
}
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/ccn" );
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 = "{ \"operation\": \"protect\", \"data\": [\"4321567898765432\", \"2376876534560987\"], \"options\": { \"bin\": false } }" ;
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/ccn' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["4321567898765432" , "2376876534560987" ],
"options" : { "bin" : false }
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/ccn"
data := strings .NewReader (`{
"operation": "protect",
"data": ["4321567898765432", "2376876534560987"],
"options": {"bin": false}
}` )
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
[
"0449999816792240" ,
"6683962881463918"
]
12 - Passport (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/passport
DESCRIPTION :
Protect or unprotect a passport number. The returned passport number is case-, length- and position-preserving (i.e., generated letters and numbers will adhere to their original position). Note that some passport logic, i.e. restricted letters, is not preserved.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/passport' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["FA039020112", "CBR90110244"]
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/passport'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["FA039020112" , "CBR90110244" ]
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/passport" );
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 = "{ \"operation\": \"protect\", \"data\": [\"FA039020112\", \"CBR90110244\"] }" ;
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/passport' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["FA039020112" , "CBR90110244" ]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/passport"
data := strings .NewReader (`{
"operation": "protect",
"data": ["FA039020112", "CBR90110244"]
}` )
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
[
"IN890183422" ,
"GFR67102933"
]
13 - IBAN (PII)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/iban
DESCRIPTION :
Protect or unprotect an Internation Banking Account Number. The returned IBAN is case-, length- and position-preserving. Note that some IBAN logic, i.e., producing valid country codes or a checksum validation, is not supported. The endpoint accepts partial IBAN protection, i.e., leaving the letters in the clear.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
alpha
(optional) Set to true
to leave the original letters in the clear. Must be set to true
when unprotecting the string tokenized using this option. Accepts: [ true | false ]
. Defaults to false
.
eiv
(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 eiv
has to be provided in the payload. Note that this option is only available if alpha
is set to true
.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/iban' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["NO8330001234567", "QA54QNBA000000000000693123456"],
"options": {
"alpha": true
}
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/iban'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["NO8330001234567" , "QA54QNBA000000000000693123456" ],
"options" : {
"alpha" : "true"
}
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/iban" );
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 = "{ \"operation\": \"protect\", \"data\": [\"NO8330001234567\", \"QA54QNBA000000000000693123456\"], \"options\": { \"alpha\": \"true\" } }" ;
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/iban' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["NO8330001234567" , "QA54QNBA000000000000693123456" ],
"options" : {
"alpha" : true
}
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/iban"
data := strings .NewReader (`{
"operation": "protect",
"data": ["NO8330001234567", "QA54QNBA000000000000693123456"],
"options": {
"alpha": true
}
}` )
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
[
"NO0980006979071" ,
"QA13QNBA128618782491645358717"
]
14 - String
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/string
DESCRIPTION :
Protect or unprotect a string. Maximum length of the string is 128 characters. The returned string is not length-preserving neither case-preserving.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
eiv
(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 eiv
has to be provided in the payload.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/string' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["hello", "world"]
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/string'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["hello" , "world" ]
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/string" );
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 = "{ \"operation\": \"protect\", \"data\": [\"Hello\", \"World\"] }" ;
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/string' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["hello" , "world" ]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/string"
data := strings .NewReader (`{
"operation": "protect",
"data": ["hello", "world"]
}` )
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
15 - Number
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/number
DESCRIPTION :
Protect or unprotect a number. The returned number is length-preserving. The endpoint might generate numbers with leading zeros.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
eiv
(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 eiv
has to be provided in the payload.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/number' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["123654", "987654"]
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/number'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["123654" , "987654" ]
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/number" );
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 = "{ \"operation\": \"protect\", \"data\": [\"123654\", \"987654\"] }" ;
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/number' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["123654" , "987654" ]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/number"
data := strings .NewReader (`{
"operation": "protect",
"data": ["123654", "987654"]
}` )
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
16 - Text (Encryption)
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/text
DESCRIPTION :
Protect or unprotect sample text using encryption. Received text must be hex encoded. The returned value is hex encoded. There is no limitation on the text’s length however payload limits apply.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/text' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["48656c6c6f20576f726c640a"]
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/text'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["48656c6c6f20576f726c640a" ]
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/text" );
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 = "{ \"operation\": \"protect\", \"data\": [\"48656c6c6f20576f726c640a\"] }" ;
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/text' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["48656c6c6f20576f726c640a" ]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/text"
data := strings .NewReader (`{
"operation": "protect",
"data": ["48656c6c6f20576f726c640a"]
}` )
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
[
"E616C7B0762E28A32E0FABF4BC403C8D"
]
17 - Datetime
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/datetime
DESCRIPTION :
Protect or unprotect a datetime string The endpoint accepts partial timestamp protection, i.e., leaving the year value in the clear. Supported formats: YYYY/MM/DD and YYYY/MM/DD HH:MM:SS. Supported delimiters: /, -, .; space or T are supported between date and time.
ATTRIBUTES :
data
(required) Input data to transform.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
year
(optional) Set to true
to leave the year in the clear. Must be set to true
when unprotecting the string tokenized using this option. Accepts: [ true | false ]
. Defaults to false
.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/datetime' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '{
"operation": "protect",
"data": ["1980/12/10 14:12:01", "1965/01/27"],
"options": {
"year": true
}
}'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/datetime'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = {
"operation" : "protect" ,
"data" : ["1980/12/10 14:12:01" , "1965/01/27" ],
"options" : {
"year" : true
}
}
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/datetime" );
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 = "{ \"operation\": \"protect\", \"data\": [\"1980/12/10 14:12:01\", \"1965/01/27\"], \"options\": { \"year\": \"true\" } }" ;
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/datetime' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : ["1980/12/10 14:12:01" , "1965/01/27" ],
"options" : {
"year" : true
}
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/datetime"
data := strings .NewReader (`{
"operation": "protect",
"data": ["1980/12/10 14:12:01", "1965/01/27"],
"options": {
"year": true
}
}` )
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
[
"1980/03/24 03:19:45" ,
"1965/08/11"
]
18 - Multitype
Data protection endpoint
METHOD : POST
ENDPOINT : https://api.playground.protegrity.com/v1/multi
DESCRIPTION :
Protect or unprotect various attributes within a payload. Please refer to the specific payload type descriptions to see available options.
ATTRIBUTES :
data
(required) Input data to transform.
type
(required) Type of data provided. It should match one of available Data Protection endpoints, e.g. name, address, ccn.
operation
(required) Specify if to protect or unprotect data. Accepts: [ protect | unprotect ]
.
id
(required) A numeric id for tracking separete elements.
user
(optional) Choose a user to impersonate from the list of pre-configured roles .
OPTIONS :
options
(optional) Options as available for each endpoint type.
SAMPLE REQUEST
cURL
Python
Java
JavaScript
Go
curl --location 'https://api.playground.protegrity.com/v1/multi' \
--header 'x-api-key: <API_Key>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <JWT_TOKEN>' \
--data '[
{
"id": 1,
"type": "address",
"operation": "protect",
"data": ["Place 8 Rue Nicolau", "46 avenue de la Grande Armée"],
"options":{
"dictionary": "fr"
}
},
{
"id": 2,
"type": "city",
"operation": "protect",
"data": ["Paris"]
}
]'
import requests
import json
JWT_Token = "<JWT_TOKEN>"
API_Key = "<API_Key>"
url = 'https://api.playground.protegrity.com/v1/multi'
headers = { 'x-api-key' : API_Key, 'Content-Type' : 'application/json' , 'Authorization' : JWT_Token }
data = [
{
"id" : 1 ,
"type" : "address" ,
"operation" : "protect" ,
"data" : ["Place 8 Rue Nicolau" , "46 avenue de la Grande Armée" ],
"options" :{
"dictionary" : "fr"
}
},
{
"id" : 2 ,
"type" : "city" ,
"operation" : "protect" ,
"data" : ["Paris" ]
}
]
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 = "<API_Key>"
URI uri = new URI("https://api.playground.protegrity.com/v1/mutli" );
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 = "{ \"operation\": \"protect\", \"data\": [\n" + //
" {\n" + //
" \"id\": 1,\n" + //
" \"type\": \"address\",\n" + //
" \"operation\": \"protect\",\n" + //
" \"data\": [\"Place 8 Rue Nicolau\", \"46 avenue de la Grande Armée\"],\n" + //
" \"options\":{\n" + //
" \"dictionary\": \"fr\"\n" + //
" }\n" + //
" },\n" + //
" {\n" + //
" \"id\": 2,\n" + //
" \"type\": \"city\",\n" + //
" \"operation\": \"protect\",\n" + //
" \"data\": [\"Paris\"]\n" + //
" }\n" + //
"] }" ;
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/multi' ,
{ method : 'POST' ,
headers : { 'x-api-key' : '<API_Key>' , 'Content-Type' : 'application/json' , 'Authorization' : '<JWT_TOKEN>' },
body : JSON .stringify ({
"operation" : "protect" ,
"data" : [
{
"id" : 1 ,
"type" : "address" ,
"operation" : "protect" ,
"data" : ["Place 8 Rue Nicolau" , "46 avenue de la Grande Armée" ],
"options" : {
"dictionary" : "fr"
}
},
{
"id" : 2 ,
"type" : "city" ,
"operation" : "protect" ,
"data" : ["Paris" ]
}
]
})
})
.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 := "<API_Key>"
url := "https://api.playground.protegrity.com/v1/multi"
data := strings .NewReader (`{
"operation": "protect",
"data": [
{
"id": 1,
"type": "address",
"operation": "protect",
"data": ["Place 8 Rue Nicolau", "46 avenue de la Grande Armée"],
"options":{
"dictionary": "fr"
}
},
{
"id": 2,
"type": "city",
"operation": "protect",
"data": ["Paris"]
}
]
}` )
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
[
{
"id" : "1" ,
"results" : [
"è6HmO s 0Cq okÎHWmxÛR" ,
"sC ÈÂÉÉut éj Âî C1io3V 7xIoZSV"
]
} ,
{
"id" : "2" ,
"results" : [
"ôdnÂefp"
]
}
]