Introduction to Redaction API
The Redaction API is a powerful tool designed to automatically detect and remove or mask Personally Identifiable Information (PII) and other sensitive data from your text content.
By integrating our API, you can easily process text to ensure compliance with privacy regulations like GDPR and CCPA, protect user data, and secure confidential information before it's stored or shared. The API can identify dozens of information types, from credit card numbers to email addresses, and offers flexible options for how the data is redacted.
Authentication
API requests should be sent to the URL: https://www.redactionapi.net/api/
A valid API key is needed to obtain results from our API endpoints and is available by purchasing a subscription to our plans. After obtaining a plan, please log in to retrieve your API key.
Our API service expects for the API key to be included in all API requests to the server, as a parameter:
api_key: your_api_key_here
HTTP responses that are successful will have the status code 200 and the response formatted according to the specification. Please see the documentation for examples.
Our servers return API data in JSON format by default.
Rules and limits
The API returns both your total credits (under `total_credits`) as well as your remaining credits (under `remaining_credits`) in each response.
Pay attention to the number of API credits you still have remaining. If you exhaust your credits, you can purchase more on our pricing page or upgrade your plan.
Redacting Information from Text
To redact information, you send a POST request containing the text and the types of information you wish to redact. The API returns two versions of the text: one with sensitive data completely removed (`redact`) and another with the data replaced by a masking character (`mask`).
Select Masking Character
You can specify the character used for masking PII by using the `mask_char` parameter. If not provided, '#' will be used by default.
- #
- *
- X
- █
Select Information Types to Redact
Specify the types of information to redact in a comma-separated list via the `mask` parameter. We support redaction of the following types (and 50+ more, contact us for full list or see full documentation for details):
- AWS Credentials
- Authorization Token
- Azure Auth Token
- CVV Number
- Credit Card Data (Full)
- Credit Card Expiration Date
- Credit Card Number
- Demographic Data
- Source Code
- Driver's License Number
- Email Address
- Ethnic Group
- Financial Account Number
- GCP Credentials
- Gender
- Geographic Data
- IBAN Code
- IP Address
- Marital Status
- Medical Data
- Medical Term
- Phone Number
Curl POST Request
To run your API request with Curl, copy the following command and make sure to replace `your_api_key` with your own API key:curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d 'parameters=The new user is Alice, email: [email protected], IP: 192.168.1.1&mask=Email Address,IP Address&mask_char=*&api_key=your_api_key' 'https://www.redactionapi.net/api/redact.php'
Query Parameters
Parameter | Type | Description |
---|---|---|
parameters | string | The input text to be processed for redaction. |
mask | string | A comma-separated list of information types to redact (e.g., "Email Address,Phone Number"). |
mask_char | string | (Optional) The character to use for masking sensitive information. Can be '#', '*', 'X', or '█'. Defaults to '#'. |
api_key | string | Your personal API key. |
The above command returns a response in JSON format, structured like this:
{"redact": "The new user is John Doe, email: , IP: ", "mask": "The new user is Alice, email: ********************, IP: ***********", "status": 200, "total_credits": 100000, "remaining_credits": 99999}
Example code
Below you can find minimal example code for using our API in different programming languages.
Example code in Python
import http.client
import urllib.parse
conn = http.client.HTTPSConnection("www.redactionapi.net")
payload = urllib.parse.urlencode({
'parameters': 'My email is [email protected] and my credit card is 4111-1111-1111-1111.',
'mask': 'Email Address,Credit Card Number',
'api_key': 'your_api_key'
})
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/api/redact.php", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Example code in Javascript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("parameters", "My email is [email protected] and my phone number is (555) 123-4567.");
urlencoded.append("mask", "Email Address,Phone Number");
urlencoded.append("api_key", "your_api_key");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://www.redactionapi.net/api/redact.php", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Errors
The API returns a `status` value in each request. A status of 200 indicates success.
In case of an error, the status error code can be interpreted using the following table:
Error Code | Meaning |
---|---|
200 | Request was successful. |
400 | Error in forming the request. Please check the documentation on how to form an API request. |
401 | Your API key is invalid or missing. Please check your API key for potential misspellings. If the problem persists, contact us. |
403 | You have used up your monthly quota for API requests. Please upgrade your plan or add credits to your account. |
422 | Missing or invalid parameters. Ensure `parameters` and `mask` are provided and correctly formatted. |
500 | An internal server error occurred. Please check if your request was properly formatted. If the problem persists, please contact us. |