Redact text strings

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 list of supported entity types

get
Responses
200
OK
application/json
get
GET /api/Redact/pii_types HTTP/1.1
Host: 
Accept: */*
200

OK

[
  "NUMERIC_VALUE"
]

Redact entities in plain text

post

Returns a modified version of the provided text string that redacts or synthesizes the detected entity values.

Body
all ofOptional
Responses
200
OK
application/json
post
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"
}
200

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
    }
  ]
}

Redact plain text entities in bulk

post

Returns a modified version of the provided text string that redacts or synthesizes the detected entity values.

Body
all ofOptional
Responses
200
OK
application/json
post
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"
  ]
}
200

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
    }
  ]
}

Redact entities in JSON and preserve the JSON structure

post

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.

Body
all ofOptional
Responses
200
OK
application/json
post
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"
    ]
  }
}
200

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
    }
  ]
}

Redact entities in XML and preserve the XML structure

post

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.

Body
all ofOptional
Responses
200
OK
application/json
post
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            "
}
200

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
    }
  ]
}

Redact entities in HTML and preserve the HTML structure

post

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.

Body
all ofOptional
Responses
200
OK
application/json
post
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            "
}
200

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
    }
  ]
}

Last updated

Was this helpful?