Redact text strings
Last updated
Was this helpful?
Last updated
Was this helpful?
You can use the Tonic Textual REST API to redact text strings, including:
Plain text
JSON
XML
HTML
Textual provides a specific endpoint for each format. For JSON, XML, and HTML, Textual only redacts the text values. It preserves the underlying structure.
Returns a modified version of the provided text string that redacts or synthesizes the detected entity values.
POST /api/Redact HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 716
{
"generatorConfig": {
"NAME_GIVEN": "Redaction",
"NAME_FAMILY": "Redaction"
},
"generatorDefault": "Off",
"docXImagePolicy": "Redact",
"docXCommentPolicy": "Remove",
"pdfSignaturePolicy": "Redact",
"pdfSynthModePolicy": "V1",
"docXTablePolicy": "Redact",
"labelBlockLists": {
"NAME_FAMILY": {
"strings": [],
"regexes": [
".*\\s(disease|syndrom|disorder)"
]
}
},
"labelAllowLists": {
"HEALTHCARE_ID": {
"strings": [],
"regexes": [
"[a-z]{2}\\d{9}"
]
}
},
"customModels": [
"text"
],
"generatorMetadata": {
"ANY_ADDITIONAL_PROPERTY": {
"version": "V1",
"customGenerator": "Scramble",
"swaps": {
"ANY_ADDITIONAL_PROPERTY": "text"
}
}
},
"recordApiRequestOptions": {
"record": true,
"retentionTimeInHours": 1,
"tags": [
"text"
]
},
"customPiiEntityIds": [
"text"
],
"text": "My name is John Smith"
}
OK
{
"originalText": "text",
"redactedText": "text",
"usage": 1,
"deIdentifyResults": [
{
"start": 1,
"end": 1,
"newStart": 1,
"newEnd": 1,
"label": "text",
"text": "text",
"newText": "text",
"score": 1,
"language": "text",
"exampleRedaction": "text",
"jsonPath": "text",
"xmlPath": "text",
"idx": 1
}
]
}
Returns a modified version of the provided text string that redacts or synthesizes the detected entity values.
POST /api/Redact/bulk HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 705
{
"generatorConfig": {
"NAME_GIVEN": "Redaction",
"NAME_FAMILY": "Redaction"
},
"generatorDefault": "Off",
"docXImagePolicy": "Redact",
"docXCommentPolicy": "Remove",
"pdfSignaturePolicy": "Redact",
"pdfSynthModePolicy": "V1",
"docXTablePolicy": "Redact",
"labelBlockLists": {
"NAME_FAMILY": {
"strings": [],
"regexes": [
".*\\s(disease|syndrom|disorder)"
]
}
},
"labelAllowLists": {
"HEALTHCARE_ID": {
"strings": [],
"regexes": [
"[a-z]{2}\\d{9}"
]
}
},
"customModels": [
"text"
],
"generatorMetadata": {
"ANY_ADDITIONAL_PROPERTY": {
"version": "V1",
"customGenerator": "Scramble",
"swaps": {
"ANY_ADDITIONAL_PROPERTY": "text"
}
}
},
"recordApiRequestOptions": {
"record": true,
"retentionTimeInHours": 1,
"tags": [
"text"
]
},
"customPiiEntityIds": [
"text"
],
"bulkText": [
"text"
]
}
OK
{
"bulkText": [
"text"
],
"bulkRedactedText": [
"text"
],
"usage": 1,
"deIdentifyResults": [
{
"start": 1,
"end": 1,
"newStart": 1,
"newEnd": 1,
"label": "text",
"text": "text",
"newText": "text",
"score": 1,
"language": "text",
"exampleRedaction": "text",
"jsonPath": "text",
"xmlPath": "text",
"idx": 1
}
]
}
Returns a modified version of the JSON that redacts or synthesizes the detected entity values. The redacted JSON has the same structure as the input JSON. Only the primitive JSON values, such as strings and numbers, are modified.
POST /api/Redact/json HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 744
{
"generatorConfig": {
"NAME_GIVEN": "Redaction",
"NAME_FAMILY": "Redaction"
},
"generatorDefault": "Off",
"docXImagePolicy": "Redact",
"docXCommentPolicy": "Remove",
"pdfSignaturePolicy": "Redact",
"pdfSynthModePolicy": "V1",
"docXTablePolicy": "Redact",
"labelBlockLists": {
"NAME_FAMILY": {
"strings": [],
"regexes": [
".*\\s(disease|syndrom|disorder)"
]
}
},
"labelAllowLists": {
"HEALTHCARE_ID": {
"strings": [],
"regexes": [
"[a-z]{2}\\d{9}"
]
}
},
"customModels": [
"text"
],
"generatorMetadata": {
"ANY_ADDITIONAL_PROPERTY": {
"version": "V1",
"customGenerator": "Scramble",
"swaps": {
"ANY_ADDITIONAL_PROPERTY": "text"
}
}
},
"customPiiEntityIds": [
"text"
],
"jsonText": "{\"Name\": \"John Smith\", \"Description\": \"John lives in Atlanta, Ga.\"}",
"jsonPathAllowLists": {
"NAME_GIVEN": [
"$.name.first"
]
}
}
OK
{
"originalText": "text",
"redactedText": "text",
"usage": 1,
"deIdentifyResults": [
{
"start": 1,
"end": 1,
"newStart": 1,
"newEnd": 1,
"label": "text",
"text": "text",
"newText": "text",
"score": 1,
"language": "text",
"exampleRedaction": "text",
"jsonPath": "text",
"xmlPath": "text",
"idx": 1
}
]
}
Returns a modified version of the XML that redacts or synthesizes the detected entity values. The redacted XML has the same structure as the input XML. Only the XML inner text and attribute values are modified.
POST /api/Redact/xml HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 825
{
"generatorConfig": {
"NAME_GIVEN": "Redaction",
"NAME_FAMILY": "Redaction"
},
"generatorDefault": "Off",
"docXImagePolicy": "Redact",
"docXCommentPolicy": "Remove",
"pdfSignaturePolicy": "Redact",
"pdfSynthModePolicy": "V1",
"docXTablePolicy": "Redact",
"labelBlockLists": {
"NAME_FAMILY": {
"strings": [],
"regexes": [
".*\\s(disease|syndrom|disorder)"
]
}
},
"labelAllowLists": {
"HEALTHCARE_ID": {
"strings": [],
"regexes": [
"[a-z]{2}\\d{9}"
]
}
},
"customModels": [
"text"
],
"generatorMetadata": {
"ANY_ADDITIONAL_PROPERTY": {
"version": "V1",
"customGenerator": "Scramble",
"swaps": {
"ANY_ADDITIONAL_PROPERTY": "text"
}
}
},
"customPiiEntityIds": [
"text"
],
"xmlText": "\n <note>\n <to>Tove</to>\n <from>Jani</from>\n <heading>Reminder</heading>\n <body>Don't forget me this weekend!</body>\n </note>\n "
}
OK
{
"originalText": "text",
"redactedText": "text",
"usage": 1,
"deIdentifyResults": [
{
"start": 1,
"end": 1,
"newStart": 1,
"newEnd": 1,
"label": "text",
"text": "text",
"newText": "text",
"score": 1,
"language": "text",
"exampleRedaction": "text",
"jsonPath": "text",
"xmlPath": "text",
"idx": 1
}
]
}
Returns a modified version of the HTML that redacts or synthesizes the detected entity values. The redacted HTML has the same structure as the input HTML. Only the text contained in the HTML elements is modified.
POST /api/Redact/html HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 830
{
"generatorConfig": {
"NAME_GIVEN": "Redaction",
"NAME_FAMILY": "Redaction"
},
"generatorDefault": "Off",
"docXImagePolicy": "Redact",
"docXCommentPolicy": "Remove",
"pdfSignaturePolicy": "Redact",
"pdfSynthModePolicy": "V1",
"docXTablePolicy": "Redact",
"labelBlockLists": {
"NAME_FAMILY": {
"strings": [],
"regexes": [
".*\\s(disease|syndrom|disorder)"
]
}
},
"labelAllowLists": {
"HEALTHCARE_ID": {
"strings": [],
"regexes": [
"[a-z]{2}\\d{9}"
]
}
},
"customModels": [
"text"
],
"generatorMetadata": {
"ANY_ADDITIONAL_PROPERTY": {
"version": "V1",
"customGenerator": "Scramble",
"swaps": {
"ANY_ADDITIONAL_PROPERTY": "text"
}
}
},
"customPiiEntityIds": [
"text"
],
"htmlText": "\n <!DOCTYPE html>\n <html>\n <body>\n <h1>Account Information</h1>\n <p>Account Holder: John Smith</p>\n </body>\n </html>\n "
}
OK
{
"originalText": "text",
"redactedText": "text",
"usage": 1,
"deIdentifyResults": [
{
"start": 1,
"end": 1,
"newStart": 1,
"newEnd": 1,
"label": "text",
"text": "text",
"newText": "text",
"score": 1,
"language": "text",
"exampleRedaction": "text",
"jsonPath": "text",
"xmlPath": "text",
"idx": 1
}
]
}