---
title: "Decode Privacy Twins"
method: POST
path: "/api/scanner/decode"
tags: ["Decoding"]
---

# Decode Privacy Twins

`POST /api/scanner/decode`

Decode Privacy Twins back to original sensitive values. Creates an audit trail entry recording who accessed the data and for what purpose.

Requires the `continuationId` from the original encoding, the text containing Privacy Twins, and the hashes of the original values to decode.

**SDK Usage:**
```typescript
const decoded = await client.decode({
  continuationId: 'cont-7f3a-4b2c-9d1e-8f6a5c3b2d1e',
  data: 'Maria Garcia, SSN: 987-65-4321',
  sensitiveHashes: ['a1b2c3d4...'],
  authorization: {
    token: 'your-jwt-token',
    purpose: 'Customer support ticket #12345'
  }
});
```

## Request body

- DecodeRequest
  - `continuationId` string, required — Continuation ID from the original encoding operation
  - `data` string, required — Text containing Privacy Twins to decode
  - `sensitiveHashes` string[], required — Array of original value hashes to decode
  - `authorization` DecodeAuthorization, required
    - `token` string, required — JWT or authorization token
    - `purpose` string, required — Reason for accessing the sensitive data (recorded in audit trail)
    - `type` string — Authorization type

## Response `200`

Decoded successfully

- DecodeResponse
  - `success` boolean
  - `decodedData` string — Text with Privacy Twins replaced by original values
  - `transformations` DecodedTransformation[]
    - `twin` string — The Privacy Twin value
    - `original` string — The original PII value
    - `entityType` string — Type of PII entity
    - `decrypted` boolean — Whether decryption was successful
    - `catalogItemId` string
  - `continuationId` string
  - `auditLog` AuditLog — Record of who accessed the sensitive data and why
    - `accessedBy` string — Email of the user who accessed the data
    - `timestamp` string, date-time
    - `purpose` string — Stated purpose for accessing the data
    - `transformationsCount` integer — Number of transformations decoded
  - `statistics` DecodingStatistics
    - `originalLength` integer
    - `decodedLength` integer
    - `twinsDecoded` integer
    - `processingTimeMs` number
  - `error` string

## Other responses

- `401` — Authentication failed or token expired
- `403` — Trial expired or subscription required

## Changes

- **2026-08-20** `0e1db3b6bc7c` — 6 breaking, 7 info
  - added the new required request property `authorization`
  - added the new required request property `continuationId`
  - added the new required request property `data`
  - added the new required request property `sensitiveHashes`
  - …9 more
- **2026-03-07** `f19009a654f5` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/privacypal/apis/privacypal-api/changes/api/scanner/decode/post.md)

---

[API](https://skmtc.dev/privacypal/apis/privacypal-api.md) · [All operations](https://skmtc.dev/privacypal/apis/privacypal-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/privacypal/privacypal-api/revisions/0e1db3b6bc7c/schema)
