How to use the PII Vault API – Python Edition

Last updated 09/06/2021


The purpose of this document is to provide an introduction for Python developers on how to utilize the PII Vault API, along with code examples. This document should be consistent with what is seen in the corresponding repository, which is an open source program to help developers walk through how the API is used.

All requests in the API return a JSON response with some specific fields that make all API responses consistent regardless of what end point is called.

This document assumes the developer has some background in writing code in Python and/or has experience calling REST APIs.


This accompanying project was set up in Python 3 and it is highly recommended to use the latest version of Python to accomplish using this API.

At the time of this writing, the following entries were made into the requirements.txt file



This python library will be used to make our HTTP requests to the API.

Accompanying Classes

Several Python classes were written in this project to assist in more mundane tasks of calling the API. This document will explain the points of interest so if a developer decides to write their own classes or methods, they fully understand what to expect.

Call Python Files

The intention of these files is to perform the setup to eventually call the API. It includes steps to request the token needed for authorization, and making the call itself.

This file calls the endpoint at:

After sending 1 mock profile to the API, the response is printed on screen after running: python

This file calls the endpoint at:

After sending 3 mock profiles to the API, the response is printed on screen after running: python

Base Python Classes

High level classes meant to help with more redundant tasks to prepare to call the API.

Reads the settings.json file that will contain vital information such as endpoint URLs and API keys.

Meant to represent a basic error object.

Meant to represent a base API response, send the response JSON through this.

Here is what a base use of this class is meant to look like:

import requests

from Settings import Settings

from ApiResponse import ApiResponse

from Profile import Profile

from ObjectBuilder import ObjectBuilder

# Initialize the setings

settings = Settings()

# Build the request to get the token

request =[“Urls”][“AuthLoginUrl”], json=settings.get_api_auth_data())

# Token request response

response = request.json()

# Object to represent the API response

api_response = ApiResponse()


if api_response.success:

# Token granted




Object Classes

Meant to build hardcoded values for demonstration purposes.

Means to hold multiple Profile objects.

Base profile class.,,,

Classes to be contained with the profile class.

It should be observed


This should get a developer started on how to use Python to call the PII Vault API. To get a full grasp of all of the possible end points with this API, you may consult the following URL: This should allow a developer to get started using this API and service to help with anonymizing sensitive data.