> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenetlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# De-identify text

> Replace every detected span with a typed placeholder (`[EMAIL_1]`, `[FIRST_NAME_1]`) and store the originals in the vault under a session, each sealed to the current vault key pair's public key. The detect service can't decrypt them. Omit `session_id` to start a new session; pass a server-issued one to extend it. A value that recurs in a session reuses its placeholder. Every write extends the session's sliding TTL.



## OpenAPI

````yaml /pii-engine/api-reference/openapi.json post /deidentify
openapi: 3.1.0
info:
  title: Tenet PII Engine (Enterprise)
  version: current
  description: >-
    Two services from one image, each behind its own Amazon VPC Lattice service
    inside your VPC. The detect service serves `POST /detect`, `/redact`,
    `/deidentify` and `DELETE /sessions/{session_id}`. The rehydrate service
    serves `POST /reidentify` only. Callers sign every request with SigV4
    (service `vpc-lattice-svcs`) as their own IAM role, over HTTPS on 443; each
    service's auth policy names the roles allowed per route. Anything outside a
    service's routes is a 404 from Lattice. Generated from the services' own
    OpenAPI schema.
servers:
  - url: https://{detect_endpoint}
    description: >-
      Detect service: the `DetectEndpoint` output (Terraform `detect_endpoint`;
      EKS: the detect HTTPRoute's assigned domain name).
    variables:
      detect_endpoint:
        default: >-
          tenet-pii-detect-0123456789abcdef0.7d67968.vpc-lattice-svcs.us-east-1.on.aws
  - url: https://{rehydrate_endpoint}
    description: >-
      Rehydrate service: the `RehydrateEndpoint` output. Only roles in the
      rehydrate invoker list (and break-glass).
    variables:
      rehydrate_endpoint:
        default: >-
          tenet-pii-rehydrate-0123456789abcdef0.7d67968.vpc-lattice-svcs.us-east-1.on.aws
security: []
tags:
  - name: Detect service
    description: Detection, de-identification and erasure. Never returns stored plaintext.
  - name: Rehydrate service
    description: >-
      Re-identification. Privileged, audited, a separate service and auth
      policy.
  - name: Health
    description: >-
      Probes inside each task or pod on port 19991. Not routed through VPC
      Lattice.
paths:
  /deidentify:
    post:
      tags:
        - Detect service
      summary: De-identify text
      description: >-
        Replace every detected span with a typed placeholder (`[EMAIL_1]`,
        `[FIRST_NAME_1]`) and store the originals in the vault under a session,
        each sealed to the current vault key pair's public key. The detect
        service can't decrypt them. Omit `session_id` to start a new session;
        pass a server-issued one to extend it. A value that recurs in a session
        reuses its placeholder. Every write extends the session's sliding TTL.
      operationId: deidentify_endpoint_deidentify_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeidentifyRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeidentifyResponse'
        '400':
          description: >-
            Malformed `session_id` (not an id the server issues), or the session
            reached its placeholder limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
              example:
                detail: 'malformed session id: ''not-a-session'''
        '403':
          description: >-
            Refused. Either VPC Lattice denied the request under the service's
            auth policy (the caller's role isn't allowed this route and method,
            the request isn't SigV4-signed for `vpc-lattice-svcs`, the source
            VPC isn't allowed, or the approval tag is missing), or the service's
            own re-check refused it (peer outside the Lattice ranges, missing
            identity headers, another service's ARN, a non-canonical path, or a
            principal outside the route's allow-list). The service's refusal is
            the fixed body below and logs the reason at WARNING; Lattice's
            refusal carries Lattice's own body. Never retried by the client.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
              example:
                detail: forbidden
        '404':
          description: A client-supplied `session_id` that is unknown or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
              example:
                detail: unknown or expired session_id
        '409':
          description: Two concurrent writers to one session. Retry the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
              example:
                detail: concurrent deidentify writes to one session; retry the request
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - sigv4: []
      servers:
        - url: https://{detect_endpoint}
          description: >-
            Detect service: the `DetectEndpoint` output (Terraform
            `detect_endpoint`; EKS: the detect HTTPRoute's assigned domain
            name).
          variables:
            detect_endpoint:
              default: >-
                tenet-pii-detect-0123456789abcdef0.7d67968.vpc-lattice-svcs.us-east-1.on.aws
components:
  schemas:
    DeidentifyRequest:
      properties:
        text:
          type: string
          title: Text
        confidence_threshold:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence Threshold
        code_filter:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Code Filter
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
      type: object
      required:
        - text
      title: DeidentifyRequest
    DeidentifyResponse:
      properties:
        text:
          type: string
          title: Text
        session_id:
          type: string
          title: Session Id
        expires_at:
          type: number
          title: Expires At
        findings:
          items:
            $ref: '#/components/schemas/FindingOut'
          type: array
          title: Findings
        timings:
          $ref: '#/components/schemas/DeidentifyTimings'
      type: object
      required:
        - text
        - session_id
        - expires_at
        - findings
        - timings
      title: DeidentifyResponse
    ErrorDetail:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    FindingOut:
      properties:
        label:
          type: string
          title: Label
        start:
          type: integer
          title: Start
        end:
          type: integer
          title: End
        confidence:
          type: number
          title: Confidence
        source:
          type: string
          title: Source
      type: object
      required:
        - label
        - start
        - end
        - confidence
        - source
      title: FindingOut
    DeidentifyTimings:
      properties:
        detect_ms:
          type: number
          title: Detect Ms
        vault_ms:
          type: number
          title: Vault Ms
        total_ms:
          type: number
          title: Total Ms
      type: object
      required:
        - detect_ms
        - vault_ms
        - total_ms
      title: DeidentifyTimings
      description: >-
        Server-side timing of a `/deidentify` call, in milliseconds: `detect_ms`
        for detection and placeholder replacement, `vault_ms` for the rest
        (opening the session, sealing and storing the values), and `total_ms`
        for the whole call, excluding network time.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    sigv4:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        AWS Signature Version 4 for service `vpc-lattice-svcs` in the service's
        Region, signed as the caller's own IAM role, with the header
        `x-amz-content-sha256: UNSIGNED-PAYLOAD` (plus `x-amz-security-token`
        for temporary credentials). Use the `tenet-pii-lattice` client or any
        SigV4 signer. The role needs `vpc-lattice-svcs:Invoke` in its own IAM
        policy and must be named in the service's auth policy.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.