A redaction policy usually lives in more than one place. You build and try it in the Redaction Policy Editor, Philter stores it by name and redacts with it, and later someone needs to change it. Some teams would rather keep policies as PhiSQL files in version control. This guide moves one policy along each of those paths and back.
Everything below was run with the released editor, 1.0.0, and Philter 4.0.1. The commands assume Philter at https://localhost:8080 and your API key in PHILTER_API_KEY. The quick start sets up both. Building the policy itself is covered in Build and test a redaction policy without writing JSON.
Load an editor policy into Philter
The example policy redacts email addresses and phone numbers and masks SSNs. In the editor, set Policy Name to claims-intake, add the three filters, click Generate Policy, then Download Policy. The file is claims-intake.json.
The download is longer than a hand-written policy. Version 1.0.0 writes out every field its Phileas engine knows, including internal ones, and no policy name. One filter looks like this:
"ssn": {
"ssnFilterStrategies": [
{
"filterType": "SSN",
"id": "59947d35-ccce-45f0-a10f-2ff463ec8edc",
"strategy": "MASK",
"redactionFormat": "{{{REDACTED-%t}}}",
"replacementScope": "CONTEXT",
"staticReplacement": "",
"maskCharacter": "*",
"maskLength": "SAME",
"truncateCharacter": "*",
"truncateDirection": "LEADING",
"condition": "",
"salt": false,
"anonymizationCandidates": []
}
],
"enabled": true,
"ignored": [],
"ignoredFiles": [],
"ignoredPatterns": [],
"windowSize": 5,
"priority": 0
}
Philter 4.0.1 accepts the file as it is. The name comes from the request:
curl -sk -X POST "https://localhost:8080/api/policies?name=claims-intake" \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @claims-intake.json \
-w "HTTP %{http_code}\n"
HTTP 201
Redact with it:
curl -sk "https://localhost:8080/api/filter?p=claims-intake" \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-H "Content-Type: text/plain" \
--data-binary "Claimant reached us at (217) 555-0142 and alex.morgan@example.com. SSN on file: 123-45-6789."
Claimant reached us at {{{REDACTED-phone-number}}} and {{{REDACTED-email-address}}}. SSN on file: ***********.
MASK replaces every character of the match, hyphens included.
Compare with Test Policy
Test Policy in the editor gave the same result for this text:

The two will not always agree. Editor 1.0.0 tests with Phileas 3.3.0, while Philter 4.0.1 runs Phileas 4.5.0. Treat the editor’s result as a quick check and Philter’s as the one that counts, and measure on your own documents with Philter Scope before relying on a policy.
Bring a stored policy back into the editor
Philter returns a stored policy as JSON:
curl -sk "https://localhost:8080/api/policies/claims-intake" \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-o claims-intake.json
For this policy, the file is identical to the one the editor downloaded. Upload Policy in editor 1.0.0 cannot load it, though. It stops with “Failed to parse policy JSON.” and leaves only the first filter in the form. The same happens with any policy the editor itself downloaded: the anonymizationCandidates field it writes into every strategy is one its own upload code cannot place in the form.
Remove that field before uploading (walk needs jq 1.6 or later):
jq 'walk(if type == "object" then del(.anonymizationCandidates) else . end)' \
claims-intake.json > claims-intake-edit.json
Upload claims-intake-edit.json and all three filters load, with their strategies. The policy name is not part of the JSON, so the form shows default. Type the name again before you download, and save the result back to Philter under the same name with PUT /api/policies/claims-intake.
Upload restores only what the form can show. Check the form against the file, and compare the regenerated JSON with the original before you replace a stored policy.
Write the policy in PhiSQL
Editor 1.0.0 has no PhiSQL support, but Philter 4.0.1 compiles PhiSQL itself. Save this as claims_intake.phisql:
POLICY claims_intake;
REDACT EMAIL_ADDRESS, PHONE_NUMBER WITH REDACT;
REDACT SSN WITH MASK;
Compile it:
curl -sk -X POST https://localhost:8080/api/policies/compile \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-H "Content-Type: text/plain" \
--data-binary @claims_intake.phisql
{"name":"claims_intake","policy":{"identifiers":{"emailAddress":{"emailAddressFilterStrategies":[{"strategy":"REDACT"}]},"phoneNumber":{"phoneNumberFilterStrategies":[{"strategy":"REDACT"}]},"ssn":{"ssnFilterStrategies":[{"strategy":"MASK"}]}}}}
Compiling saves nothing. Take the policy object and save it:
curl -sk -X POST https://localhost:8080/api/policies/compile \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-H "Content-Type: text/plain" \
--data-binary @claims_intake.phisql | jq '.policy' > claims_intake.json
curl -sk -X POST "https://localhost:8080/api/policies?name=claims_intake" \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @claims_intake.json \
-w "HTTP %{http_code}\n"
HTTP 201
Redacting the same text with p=claims_intake gives the same output as the editor’s policy above. The compiled JSON has none of the editor’s internal fields, so Upload Policy loads it into editor 1.0.0 directly, all three filters included, if you want to try it in Test Policy or adjust it in the form.
Known issues in editor 1.0.0
- Zip Code filters cannot be generated from the form. Adding a Zip Code filter makes Generate Policy fail, because the form sends a truncation setting of 0 that the server rejects. The Healthcare preset includes a Zip Code filter, so it fails the same way. Write ZIP code handling in PhiSQL or in the JSON after downloading.
- Upload Policy fails on the editor’s own downloads, as described above. Remove
anonymizationCandidatesfirst.
In the next release
The editor’s main branch, which is not yet released, adds an Author with PhiSQL panel that compiles PhiSQL into the form, and Copy PhiSQL and Download PhiSQL actions that write the current policy out as PhiSQL after checking that it compiles back to the same policy. It also targets redaction policy schema 1.3.0, the version Philter 4.0.1 runs, and its Healthcare preset generates. Until it is published, use Philter’s compile endpoint as shown above.