Browse operation contracts · Static machine index · OpenAPI release reference · Build manifest

Redact common PII patterns

Use as a review aid before inspecting logs or sample text. Replaces selected ASCII email, formatted US phone, XXX-XX-XXXX SSN-shaped, and valid dotted IPv4 patterns with fixed labels; returns original-source offsets without match values. Phone patterns require separators; SSN patterns do not validate issuance. Non-exhaustive heuristics can miss PII and produce false positives. Never a security, compliance, or anonymization guarantee. Maximum 10,000 matches.

text · Operation ID: pii-redact

Choose this operation when

Outside this profile

Exact release references

Static JSON contract · Markdown reference · Fixed example response

Complete input schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "maxLength": 100000
    },
    "types": {
      "default": [
        "email",
        "us-phone"
      ],
      "minItems": 1,
      "maxItems": 4,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "email",
          "us-phone",
          "us-ssn",
          "ipv4"
        ]
      }
    }
  },
  "required": [
    "text"
  ],
  "additionalProperties": false
}

Complete output-envelope schema

{
  "type": "object",
  "required": [
    "operation",
    "version",
    "result",
    "provenance"
  ],
  "properties": {
    "operation": {
      "const": "pii-redact",
      "type": "string"
    },
    "version": {
      "const": "0.29.0",
      "type": "string"
    },
    "result": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "maxLength": 300000
        },
        "offsetUnit": {
          "type": "string",
          "const": "UTF-16 code units; zero-based, end-exclusive"
        },
        "count": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10000
        },
        "counts": {
          "type": "object",
          "properties": {
            "email": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "usPhone": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "usSsn": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "ipv4": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            }
          },
          "required": [
            "email",
            "usPhone",
            "usSsn",
            "ipv4"
          ],
          "additionalProperties": false
        },
        "redactions": {
          "maxItems": 10000,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "email",
                  "us-phone",
                  "us-ssn",
                  "ipv4"
                ]
              },
              "start": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000
              },
              "end": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000
              },
              "replacement": {
                "type": "string",
                "enum": [
                  "[EMAIL]",
                  "[US_PHONE]",
                  "[US_SSN]",
                  "[IPV4]"
                ]
              }
            },
            "required": [
              "type",
              "start",
              "end",
              "replacement"
            ],
            "additionalProperties": false
          }
        },
        "warning": {
          "type": "string",
          "const": "Pattern-only redaction is non-exhaustive and can miss personal data or redact non-personal text. Do not rely on it as a security, compliance, or anonymization guarantee."
        }
      },
      "required": [
        "text",
        "offsetUnit",
        "count",
        "counts",
        "redactions",
        "warning"
      ],
      "additionalProperties": false
    },
    "provenance": {
      "type": "object",
      "required": [
        "inputSha256",
        "outputSha256",
        "deterministic",
        "externalRequests"
      ],
      "properties": {
        "inputSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "outputSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "deterministic": {
          "const": true
        },
        "externalRequests": {
          "const": 0
        }
      }
    }
  },
  "additionalProperties": false
}

Fixed example

One accepted fixed example, not a custom-input trial. No operation runs when this static page is requested.

Example input

{
  "text": "Email alex@example.com or call (415) 555-2671. Host: 192.168.1.20",
  "types": [
    "email",
    "us-phone",
    "ipv4"
  ]
}

Example response

{
  "operation": "pii-redact",
  "version": "0.29.0",
  "result": {
    "text": "Email [EMAIL] or call [US_PHONE]. Host: [IPV4]",
    "offsetUnit": "UTF-16 code units; zero-based, end-exclusive",
    "count": 3,
    "counts": {
      "email": 1,
      "usPhone": 1,
      "usSsn": 0,
      "ipv4": 1
    },
    "redactions": [
      {
        "type": "email",
        "start": 6,
        "end": 22,
        "replacement": "[EMAIL]"
      },
      {
        "type": "us-phone",
        "start": 31,
        "end": 45,
        "replacement": "[US_PHONE]"
      },
      {
        "type": "ipv4",
        "start": 53,
        "end": 65,
        "replacement": "[IPV4]"
      }
    ],
    "warning": "Pattern-only redaction is non-exhaustive and can miss personal data or redact non-personal text. Do not rely on it as a security, compliance, or anonymization guarantee."
  },
  "provenance": {
    "inputSha256": "0d19138edb2e9fa39d38a91b2e8c426bca6d4a4d1835907c24f4870e848417b1",
    "outputSha256": "6fee41bce2920ef0b94b502c04da6a3d876729b5195cade74c92883778ff91a2",
    "deterministic": true,
    "externalRequests": 0
  }
}

Bounds and precision

JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.

{
  "global": {
    "requestBytes": 131072,
    "responseBytes": 524288,
    "jsonDepth": 32,
    "jsonNodes": 20000,
    "requestsPerMinute": 60,
    "paidAttemptsPerMinute": 20,
    "idempotencyHours": 24
  },
  "operation": {
    "requestBytes": 131072,
    "responseBytes": 524288,
    "jsonDepth": 32
  }
}

Complete schemas, descriptions and cross-field validation may impose additional limits.

Proposed price and protocol definitions

{
  "unit": "one successful operation call",
  "proposedNominalUsd": "0.005",
  "sixDecimalTokenBaseUnits": "5000",
  "subscription": false,
  "includesPayerWalletOrNetworkFees": false,
  "liveQuoteVerified": false,
  "condition": "Actual SDK challenge is authoritative only within the caller's explicit authorization; configured six-decimal token peg is an operator assertion, not a conversion guarantee."
}

Protocol definitions: x402, mpp. MPP uses Tempo charge. Paid MCP execution is unsupported. All runtime readiness is not evaluated in this build.

API path templates, not endpoints on this documentation host

{
  "x402": "/v1/x402/pii-redact",
  "mpp": "/v1/mpp/pii-redact"
}

Required headers

{
  "Content-Type": "application/json",
  "Idempotency-Key": "random 16–128 character operation identifier"
}

Actual SDK challenge amount, asset, network, recipient and wallet costs must pass independent authorization. Preserve identical key, body, protocol and credential on retries; on PAYMENT_UNCERTAIN stop and reconcile.

Execution profile and provider conditions

{
  "deterministic": true,
  "externalRequests": 0,
  "maxExternalRequests": 0,
  "resultSnapshotPersisted": false,
  "fixedExampleIsIllustrativeSnapshot": false,
  "requiresPayment": true,
  "supportsMcpExecution": false
}

Deterministic supplied-input operation with no external requests or stored request/result bodies. Payment infrastructure retains payment metadata and hashes.

Failure handling

Declared requirements

Before any paid call, refresh the live operation contract and POST the complete bounded budgeted plan to the separate API's /preflight. Unknown requirements block selection; compatible preflight is not permission to spend.

Related contracts