Skip to main content

Redact | Python SDK

The Pangea Redact API helps developers limit the sprawl of sensitive information by performing redaction using defined rules.

Redact client

Redact(token, config, logger_name, config_id)

Initializes a new Redact client.

str

Pangea API token.

PangeaConfig | None

Configuration.

str

Logger name.

str | None

Configuration ID.

config = PangeaConfig(domain="pangea_domain")
redact = Redact(token="pangea_token", config=config)

Download file

Redact.download_file(url, filename)

Download a file from the specified URL and save it with the given filename.

str

URL of the file to download

str | None

Name to save the downloaded file as. If not provided, the filename will be determined from the Content-Disposition header or the URL.

Poll result

Redact.poll_result(exception)

Returns request's result that has been accepted by the server

Optional[AcceptedRequestException]

Exception that was previously raised by the SDK on a call that is being processed.

PangeaResponse

response = service.poll_result(exception)

Redact

Redact.redact(text, debug, rules, rulesets, return_result, redaction_method_overrides, llm_request, vault_parameters)

Redact sensitive information from provided text.

str

The text data to redact

bool

Setting this value to true will provide a detailed analysis of the redacted data and the rules that caused redaction

list[str]

An array of redact rule short names

list[str]

An array of redact rulesets short names

bool

Setting this value to false will omit the redacted result only returning count

Optional[RedactionMethodOverrides]

A set of redaction method overrides for any enabled rule. These methods override the config declared methods

Optional[bool]

Boolean flag to enable FPE redaction for LLM requests

Optional[VaultParameters]

A set of vault parameters to use for redaction

Pangea Response with redacted text in the response.result property, available response fields can be found in our API Documentation.

response = redact.redact(text="Jenny Jenny... 555-867-5309")

Redact structured

Redact.redact_structured(data, jsonp, format, debug, rules, rulesets, return_result, redaction_method_overrides, llm_request, vault_parameters)

Redact sensitive information from structured data (e.g., JSON).

dict, str

Structured data to redact

list[str]

JSON path(s) used to identify the specific JSON fields to redact in the structured data. Note: If jsonp parameter is used, the data parameter must be in JSON format.

RedactFormat

The format of the passed data. Default: "json"

bool

Setting this value to true will provide a detailed analysis of the redacted data and the rules that caused redaction

list[str]

An array of redact rule short names

list[str]

An array of redact rulesets short names

bool

Setting this value to false will omit the redacted result only returning count

Optional[RedactionMethodOverrides]

A set of redaction method overrides for any enabled rule. These methods override the config declared methods

Optional[bool]

Boolean flag to enable FPE redaction for LLM requests

Optional[VaultParameters]

A set of vault parameters to use for redaction

Pangea Response with redacted data in the response.result field, available response fields can be found in our API Documentation

data = {
    "number": "555-867-5309",
    "ip": "1.1.1.1",
}

response = redact.redact_structured(data=data, redact_format="json")

Unredact

Redact.unredact(redacted_data, fpe_context)

Decrypt or unredact fpe redactions

RedactedData

Data to unredact

base64

FPE context used to decrypt and unredact data

Pangea Response with redacted data in the response.result field, available response fields can be found in our API Documentation