### Get List Content Response Example Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/custom_lists_api.md Example JSON response when retrieving the content of a custom list. ```json { "items": [ "item1", "item2" ] } ``` -------------------------------- ### Install MkDocs Source: https://github.com/philterd/philter/blob/main/docs/README.md Install MkDocs and its dependencies using pip within a virtual environment. ```bash python3 -m venv venv source ./venv/bin/activate python3 -m pip install -r requirements.txt ``` -------------------------------- ### API Key Format Example Source: https://github.com/philterd/philter/blob/main/docs/docs/account/api_keys.md This shows the standard format for Philter API keys, which start with 'sk_' followed by 32 alphanumeric characters. ```text sk_abcdefghijklmnopqrstuvwxyz012345 ``` -------------------------------- ### Example Policy Response Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/policies_api.md This is an example JSON response when retrieving a policy's content. ```json { "name": "just-phone-numbers", "ignored": [ ], "identifiers": { "dictionaries": [ ], "phoneNumber": { "phoneNumberFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Docker Compose Configuration for Valkey/Redis Cache Source: https://github.com/philterd/philter/blob/main/docs/docs/caching.md This example shows how to configure Philter to use a shared Valkey/Redis cache in a Docker Compose setup. It includes adding a Valkey service and setting environment variables for the Philter service to connect to it. ```yaml philter: # ...existing configuration... environment: CACHE_HOSTNAME: valkey CACHE_PORT: 6379 CACHE_SSL: false # ...existing environment... depends_on: # ...existing dependencies... valkey: condition: service_healthy valkey: image: valkey/valkey:latest networks: - philter command: valkey-server --save 60 1 --loglevel warning healthcheck: test: ["CMD", "valkey-cli", "ping"] interval: 10s timeout: 5s retries: 5 start_period: 10s ``` -------------------------------- ### Webhook Request Example Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/webhooks.md An example of the HTTP POST request structure sent by Philter for a DOCUMENT_REDACTION_COMPLETE event. ```http POST /your-philter-webhook HTTP/1.1 Host: example.com Content-Type: application/json X-Philter-Event: DOCUMENT_REDACTION_COMPLETE X-Philter-Delivery-Id: 6a1106e9f5b4e90cb1d35a01 X-Philter-Timestamp: 1746916800 X-Philter-Signature: sha256=2c1d9...e7f0 { "event": "DOCUMENT_REDACTION_COMPLETE", "documentId": "c0c2c5a8-3a78-4e56-bf2a-44ad8b3a8e9f", "fileName": "patient-record.pdf", "status": "COMPLETE", "timestamp": "2026-05-22T21:00:00Z" } ``` -------------------------------- ### Policy Configuration Example Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/policy_schema.md A complete policy example demonstrating redaction of SSNs, anonymization of emails, date truncation, and ignoring organization names. ```json { "config": { "splitting": { "enabled": false }, "pdf": { "redactionColor": "black" } }, "identifiers": { "ssn": { "ssnFilterStrategies": [ { "strategy": "LAST_4" } ] }, "emailAddress": { "emailAddressFilterStrategies": [ { "strategy": "RANDOM_REPLACE", "anonymizationMethod": "REALISTIC", "replacementScope": "CONTEXT" } ] }, "date": { "dateFilterStrategies": [ { "strategy": "TRUNCATE_TO_YEAR" } ] }, "pheyes": [ { "phEyeFilterStrategies": [ { "strategy": "REDACT", "condition": "confidence > 0.9" } ], "phEyeConfiguration": { "endpoint": "http://ph-eye:5000" }, "thresholds": { "PER": 0.8 } } ] }, "ignored": [ { "name": "org-terms", "terms": ["Philterd", "Acme Corp"] } ] } ``` -------------------------------- ### Webhook Request Example Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/webhooks.md This example demonstrates the structure of an incoming webhook POST request from Philter, including event details and signature headers. ```APIDOC ## POST /your-philter-webhook ### Description Receives notifications from Philter about asynchronous document redaction events. ### Method POST ### Endpoint /your-philter-webhook ### Headers - **X-Philter-Event** (string) - Required - The event type (e.g., `DOCUMENT_REDACTION_COMPLETE`, `DOCUMENT_REDACTION_FAILED`). - **X-Philter-Delivery-Id** (string) - Required - The unique ID for this delivery attempt. - **X-Philter-Timestamp** (integer) - Required - Unix timestamp (seconds) of when the signature was generated. - **X-Philter-Signature** (string) - Required - HMAC-SHA256 signature of the timestamp and body, prefixed with `sha256=`. ### Request Body - **event** (string) - Required - The type of event that occurred. - **documentId** (string) - Required - The ID of the document that was processed. - **fileName** (string) - Required - The original name of the document file. - **status** (string) - Required - The status of the redaction (e.g., `COMPLETE`). - **timestamp** (string) - Required - ISO 8601 timestamp of the event. - **error** (string) - Optional - Present only for `DOCUMENT_REDACTION_FAILED` events, containing the failure message. ### Request Example ```json { "event": "DOCUMENT_REDACTION_COMPLETE", "documentId": "c0c2c5a8-3a78-4e56-bf2a-44ad8b3a8e9f", "fileName": "patient-record.pdf", "status": "COMPLETE", "timestamp": "2026-05-22T21:00:00Z" } ``` ### Response #### Success Response (200) Philter expects a successful HTTP status code (2xx) to acknowledge receipt. No specific response body is required. #### Response Example ```json {} ``` ``` -------------------------------- ### Sections Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/sections.md This example demonstrates how to configure the Sections filter with a redaction strategy. It defines the start and end patterns for sections and specifies a redaction format. ```json { "name": "sections-example", "identifiers": { "section": { "startPattern": "START", "endPattern": "END", "sectionFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } ``` -------------------------------- ### Dictionary Filter Configuration Example Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/custom_filters/dictionary.md This example shows how to configure a custom dictionary filter with terms, a file path, fuzzy matching enabled, and a specific redaction strategy. ```json { "name": "dictionary-example", "identifiers": { "dictionaries": [ "customDictionary": { "terms": ["john", "jane", "doe"], "files": "c:\\temp\\dictionary.txt", "fuzzy": true, "sensitivity": "medium", "sectionFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } ] } } ``` -------------------------------- ### Get Document Status Response Example Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/documents_api.md Example JSON response for the document status endpoint, indicating the document ID and its current processing status. ```json { "documentId": "c0c2c5a8-3a78-4e56-bf2a-44ad8b3a8e9f", "status": "PROCESSING" } ``` -------------------------------- ### States Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/locations/states.md This example demonstrates how to configure the States filter with a REDACT strategy and a specific redaction format. ```json { "name": "states-example", "identifiers": { "state": { "stateFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### URL Filter Configuration Example Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/urls.md This snippet shows how to configure the URL filter to require URLs to start with 'http' or 'www' and to redact them using a specific format. ```json { "name": "urls-example", "identifiers": { "url": { "requireHttpWwwPrefix": true, "urlFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### List Documents Response Example Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/documents_api.md Example JSON response when listing documents, showing pending redacted documents with their status and ID. ```json { "pendingRedactedDocuments": [ { "fileName": "patient-record.pdf", "status": "COMPLETE", "timestamp": "2026-05-22T20:00:00.000+00:00", "documentId": "c0c2c5a8-3a78-4e56-bf2a-44ad8b3a8e9f" } ] } ``` -------------------------------- ### First Names Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/persons_names/first-names.md An example policy demonstrating the configuration of the First Names filter with the REDACT strategy and a custom redaction format. ```json { "name": "first-names-example", "identifiers": { "firstName": { "firstNameFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Explain API Response Example Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/filtering_api.md This is an example of the JSON response from the explain endpoint, showing the filtered text and a detailed explanation of applied filters, including spans, confidence, and replacements. ```json { "filteredText": "{{{REDACTED-entity}}} was a patient and his ssn was {{{REDACTED-ssn}}}", "context": "none", "documentId": "7a906866-4fc9-44d6-9bc3-22728b93a602", "explanation": { "appliedSpans": [ { "id": "c78fb69c-84d6-4189-b376-63791793cbd2", "characterStart": 0, "characterEnd": 17, "filterType": "NER_ENTITY", "context": "C1", "documentId": "7a906866-4fc9-44d6-9bc3-22728b93a602", "confidence": 0.9189682900905609, "text": "George Washington", "replacement": "{{{REDACTED-entity}}}", "ignored": false }, { "id": "f4556f62-2f80-4edc-96f0-aa1d44802157", "characterStart": 48, "characterEnd": 59, "filterType": "SSN", "context": "C1", "documentId": "7a906866-4fc9-44d6-9bc3-22728b93a602", "confidence": 1, "text": "123-45-6789", "replacement": "{{{REDACTED-ssn}}}", "ignored": false } ], "ignoredSpans": [] } } ``` -------------------------------- ### Surnames Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/persons_names/surnames.md This example shows how to configure the Surnames filter to use the REDACT strategy with a custom redaction format. ```json { "name": "surnames-example", "identifiers": { "surname": { "surnameFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Cities Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/locations/cities.md An example policy demonstrating the configuration of the Cities filter with a specific sensitivity and redaction strategy. ```json { "name": "cities-example", "identifiers": { "city": { "sensitivity": "medium", "cityFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Get All Context Names Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/contexts_api.md Retrieves the names of all available contexts. This is useful for understanding the existing context landscape. ```bash curl -k -H "Authorization: Bearer " https://localhost:8080/api/contexts ``` -------------------------------- ### VINs Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/vins.md This example shows how to configure the VINs filter to redact identified VINs using a specific redaction format. The filter is enabled by default. ```json { "name": "vins-example", "identifiers": { "vin": { "vinFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### MAC Address Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/mac-addresses.md This example demonstrates how to configure the MAC Address filter to redact identified MAC addresses using a specific redaction format. ```json { "name": "mac-address-example", "identifiers": { "macAddress": { "macAddressFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Get Context Details Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/contexts_api.md Fetches the specific details of a given context, such as its size. Replace {name} with the actual context name. ```bash curl -k -H "Authorization: Bearer " https://localhost:8080/api/contexts/my-context ``` -------------------------------- ### Policy with CRYPTO_REPLACE Strategy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filter_strategies.md An example policy demonstrating the use of the CRYPTO_REPLACE filter strategy. The crypto key is read from an environment variable. ```json { "name": "email-address", "crypto": { "key": "env:PHILTER_CRYPTO_KEY" }, "identifiers": { "emailAddress": { "emailAddressFilterStrategies": [ { "strategy": "CRYPTO_REPLACE" } ] } } } ``` -------------------------------- ### Get Context Details Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/contexts_api.md Retrieves the details of a specific context. ```APIDOC ## GET /api/contexts/{name} ### Description Get the details of a context, where {name} is the name of the context to get. ### Method GET ### Endpoint /api/contexts/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the context to retrieve details for. ### Response #### Success Response (200) - **size** (integer) - The size of the context. ### Response Example ```json { "size": 125 } ``` ``` -------------------------------- ### Get Policy Names Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/policies_api.md Retrieve a paginated list of policy names. Use 'offset' and 'limit' to control pagination. ```bash curl -k -H "Authorization: Bearer " "https://localhost:8080/api/policies?offset=0&limit=100" ``` -------------------------------- ### Counties Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/locations/counties.md This example demonstrates how to configure the Counties filter with a specific sensitivity and redaction strategy. It uses the REDACT strategy to replace identified counties with a placeholder format. ```json { "name": "counties-example", "identifiers": { "county": { "sensitivity": "medium", "countyFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Get Context Names Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/contexts_api.md Retrieves the names of all available contexts. ```APIDOC ## GET /api/contexts ### Description Get the names of all contexts. ### Method GET ### Endpoint /api/contexts ### Response #### Success Response (200) - **contexts** (array) - A list of context names. ### Response Example ```json { "contexts": [ "default", "my-context" ] } ``` ``` -------------------------------- ### Build Documentation Site Source: https://github.com/philterd/philter/blob/main/docs/README.md Build the static documentation website using MkDocs. ```bash mkdocs build ``` -------------------------------- ### Serve Documentation Website Source: https://github.com/philterd/philter/blob/main/docs/README.md Serve the documentation website locally for development and previewing. ```bash mkdocs serve ``` -------------------------------- ### REDACT Filter Strategy with Condition for Credit Cards Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filter_strategies.md Policy example for redacting credit card numbers that meet a specific condition, such as starting with '3000'. ```json { "name": "default", "identifiers": { "creditCard": { "creditCardFilterStrategies": [ { "condition": "token startswith \"3000\"", "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Example PII Count Aggregate Document Source: https://github.com/philterd/philter/blob/main/docs/docs/diffuse.md This JSON document represents aggregated, time-bucketed document-presence counts for PII. It includes context, bucket start time, counts for specific PII types, total documents, and update timestamp. ```json { "context": "claims-intake", "bucket_start": ISODate("2026-05-31T00:00:00Z"), "counts": { "SSN": 1240, "EMAIL_ADDRESS": 8900, "PERSON": 9500 }, "total_documents": 10000, "updated_at": ISODate("2026-05-31T18:42:10Z") } ``` -------------------------------- ### Create a Context Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/contexts_api.md Creates a new context with specified parameters. ```APIDOC ## POST /api/contexts ### Description Create a new context. ### Method POST ### Endpoint /api/contexts ### Parameters #### Query Parameters - **name** (string) - Required - The name of the context to create. Context names are globally unique: if any user has already created a context with this name the request is rejected with 409 Conflict. - **entity_type_disambiguation** (boolean) - Optional (default: `false`) - Whether to enable entity type disambiguation for this context. - **ledger** (boolean) - Optional (default: `false`) - Whether to enable the redaction ledger for this context. ### Request Example ```bash curl -X POST -H "Authorization: Bearer " -k "https://localhost:8080/api/contexts?name=my-context&entity_type_disambiguation=true" ``` ``` -------------------------------- ### Create or Update Custom List Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/custom_lists_api.md Create a new custom list or overwrite an existing one with new items. Supports an optional description query parameter. Assumes SSL is enabled and uses a self-signed certificate. ```bash curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -k "https://localhost:8080/api/lists/my-list?description=My%20description" -d '["item1", "item2"]' ``` -------------------------------- ### GET /api/status Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/filtering_api.md Gets the current status of the Philter service. This endpoint is useful for monitoring and health checks. ```APIDOC ## GET /api/status ### Description Gets the current status of the Philter service. This endpoint is useful for monitoring and health checks. ### Method GET ### Endpoint /api/status ### Request Example ```curl curl -k -X GET "https://localhost:8080/api/status" ``` ``` -------------------------------- ### Example Context Entries Response Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/contexts_api.md Illustrates the structure of a successful response when querying context entries, including entry details and total count. ```json { "entries": [ { "id": "6a1101d50737f1edfcf70d77", "replacement": "{{{REDACTED-person}}}", "filterType": "PERSON", "reads": 14, "timestamp": "2026-05-22T20:00:00.000+00:00" } ], "total": 1 } ``` -------------------------------- ### Build Philter with Maven Source: https://github.com/philterd/philter/blob/main/README.md Builds the Philter application using Maven. Requires Java 17 or later. ```bash mvn clean install ``` -------------------------------- ### Hospitals Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/locations/hospitals.md An example policy demonstrating the configuration of the Hospitals filter with redaction strategy and a specific redaction format. ```json { "name": "hospitals-example", "identifiers": { "hospital": { "sensitivity": "medium", "hospitalFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Replica Set MongoDB Connection String Source: https://github.com/philterd/philter/blob/main/docs/docs/database.md Connect to a MongoDB replica set, which is recommended for production environments to ensure high availability. This example includes authentication details and specifies the replica set name. ```bash MONGODB_CONNECTION_STRING=mongodb://user:pass@host1:27017,host2:27017,host3:27017/philter?replicaSet=rs0&authSource=admin ``` -------------------------------- ### List Context Entries Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/contexts_api.md Retrieves a paginated list of token-to-replacement mappings within a context. ```APIDOC ## GET /api/contexts/{name}/entries ### Description Paginated list of token-to-replacement mappings. ### Method GET ### Endpoint /api/contexts/{name}/entries ### Parameters #### Path Parameters - **name** (string) - Required - The name of the context for which to list entries. ``` -------------------------------- ### State Abbreviations Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/locations/state-abbreviations.md This example shows how to configure the state abbreviation filter to redact identified abbreviations using a specific format. ```json { "name": "states-abbreviations-example", "identifiers": { "stateAbbreviation": { "stateAbbreviationFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Zip Code Redaction Example Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/zip-codes.md This example demonstrates how to configure the zip code filter to redact identified zip codes using a custom redaction format. ```json { "name": "zip-code-example", "identifiers": { "zipCode": { "zipCodeFilterStrategy": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### ORing Conditions with Multiple Filter Strategies Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filter_strategies.md Demonstrates how to achieve an 'OR' logic for conditions by defining separate filter strategies for each condition. ```json "ssnFilterStrategies": [ { "condition": "token != \"123-45-6789\"", "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" }, { "condition": "context == \"my-context\"", "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] ``` -------------------------------- ### Physician Names Filter Policy Example Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/persons_names/physician-names-ner.md Example policy configuration for the physician names filter. This snippet shows how to enable the REDACT strategy with a custom redaction format. ```json { "name": "physician-names-example", "identifiers": { "physicianName": { "physicianNameFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Update Philter Policy with Custom Filters Source: https://github.com/philterd/philter/blob/main/docs/docs/evaluating-performance.md This example shows how to update a Philter policy to include custom filters like bitcoin addresses, email addresses, and phone numbers. The order of filters does not impact performance. ```json { "name": "evaluation", "identifiers": { "bitcoinAddress": { "bitcoinFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] }, "emailAddress": { "emailAddressFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] }, "phoneNumber": { "phoneNumberFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Tracking Numbers Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/tracking-numbers.md This example shows how to configure the Tracking Numbers filter to redact identified tracking numbers using a custom redaction format. ```json { "name": "tracking-numbers-example", "identifiers": { "trackingNumber": { "trackingNumberFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Query Context Entries Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/contexts_api.md Retrieve a paginated list of entries within a specific context. Supports offset and limit for pagination. ```bash curl -k -H "Authorization: Bearer " \ "https://localhost:8080/api/contexts/my-context/entries?offset=0&limit=25" ``` -------------------------------- ### SSN/TIN Redaction Example Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/ssns-and-tins.md This example shows how to configure the SSN/TIN filter to redact sensitive numbers using a custom redaction format. It applies the REDACT strategy with a placeholder. ```json { "name": "ssn-tin-example", "identifiers": { "ssn": { "ssnFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Import a Mapping Table into a Context Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/contexts_api.md Imports token-to-replacement mappings into a specified context from a document. The context must exist prior to import. Requires specific authorization. ```APIDOC ## POST /api/contexts/{name}/entries/import ### Description Import token-to-replacement mappings into a context. Accepts a document in the same format produced by the export endpoint and inserts its mappings into the named context. The context must already exist. ### Method POST ### Endpoint /api/contexts/{name}/entries/import ### Authorization Only the user that created the context or an admin may import into it. Any other caller receives `404 Not Found`. ### Request Body - **(document)** - The mapping table document in JSON format, as produced by the export endpoint. ``` -------------------------------- ### Email Address Filter Policy Example Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/email-addresses.md This example shows how to configure the Email Address filter to redact identified email addresses using a specific redaction format. ```json { "name": "email-address-example", "identifiers": { "emailAddress": { "emailAddressFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Policy with FPE_ENCRYPT_REPLACE Strategy (Custom Key) Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filter_strategies.md An example policy using the FPE_ENCRYPT_REPLACE filter strategy with a user-supplied format-preserving encryption key and tweak. The key and tweak can be prefixed with `env:` to read from environment variables. ```json { "name": "credit-cards", "fpe": { "key": "...", "tweak": "..." }, "identifiers": { "creditCard": { "creditCardFilterStrategies": [ { "strategy": "FPE_ENCRYPT_REPLACE" } ] } } } ``` -------------------------------- ### Ages Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/ages.md This example demonstrates how to configure the Ages filter to redact identified age information using a specific redaction format. The filter is enabled by default. ```json { "name": "ages-example", "identifiers": { "age": { "ageFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Phone Number Redaction Example Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/phone-numbers.md This example demonstrates how to configure the Phone Numbers filter to redact identified phone numbers using a specific redaction format. The filter is enabled by default. ```json { "name": "phone-number-example", "identifiers": { "phoneNumber": { "phoneNumberFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Person's Names NER Filter Example Policy Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/persons_names/persons-names-ner.md This example shows how to configure the Person's Names NER filter to redact identified names using a specific redaction format. ```json { "name": "ner-example", "identifiers": { "person": { "phEyeFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } } } ``` -------------------------------- ### Import Entries Request Source: https://github.com/philterd/philter/blob/main/docs/docs/api_and_sdks/api/contexts_api.md Use this cURL command to import entries into a specified context. The `on_conflict` query parameter determines how to handle existing entries. ```bash curl -X POST -k -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ --data-binary @my-context-export.json \ "https://localhost:8080/api/contexts/my-context/entries/import?on_conflict=skip" ``` -------------------------------- ### Phone Number Extension Redaction Example Source: https://github.com/philterd/philter/blob/main/docs/docs/policies/filters/common_filters/phone-number-extensions.md This example demonstrates how to configure the phone number extension filter to redact identified extensions using a specified redaction format. It uses the REDACT strategy. ```json { "name": "phone-number-ext-example", "identifiers": { "phoneNumberExtension": { "phoneNumberExtensionFilterStrategies": [ { "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" } ] } ) } ``` -------------------------------- ### List Context Entries Source: https://github.com/philterd/philter/blob/main/RELEASE_NOTES.md Retrieves a paginated list of entries for a given context. ```APIDOC ## GET /api/contexts/{name}/entries ### Description Provides a paginated list of entries for a specified context, including details like id, replacement, filter type, read count, and timestamp. ### Method GET ### Endpoint `/api/contexts/{name}/entries` ### Parameters #### Path Parameters - **name** (string) - Required - The name of the context. #### Query Parameters - **offset** (integer) - Optional - The starting offset for pagination. - **limit** (integer) - Optional - The maximum number of entries to return. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the entry. - **replacement** (string) - The replacement value for the entry. - **filter_type** (string) - The type of filter applied. - **reads** (integer) - The number of times the entry has been read. - **timestamp** (string) - The timestamp of the entry. #### Response Example (Example not provided in source) ```