0

Redact a Verification

by
Published Apr 8, 2025

Permanently deletes personally identifiable information (PII) for a Verification. **This action cannot be undone**. This endpoint can be used to comply with privacy regulations such as GDPR / CCPA or to enforce data privacy.

Script persona Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Persona = {
3
  apiKey: string;
4
};
5
/**
6
 * Redact a Verification
7
 * Permanently deletes personally identifiable information (PII) for a Verification. **This action cannot be undone**. This endpoint can be used to comply with privacy regulations such as GDPR / CCPA or to enforce data privacy.
8
 */
9
export async function main(
10
  auth: Persona,
11
  verification_id: string,
12
  Key_Inflection?: string,
13
  Idempotency_Key?: string,
14
  Persona_Version?: string,
15
) {
16
  const url = new URL(
17
    `https://api.withpersona.com/api/v1/verifications/${verification_id}`,
18
  );
19
  const headers: Record<string, string> = {
20
    Authorization: `Bearer ${auth.apiKey}`,
21
  };
22
  if (Key_Inflection) {
23
    headers["Key-Inflection"] = Key_Inflection;
24
  }
25
  if (Idempotency_Key) {
26
    headers["Idempotency-Key"] = Idempotency_Key;
27
  }
28
  if (Persona_Version) {
29
    headers["Persona-Version"] = Persona_Version;
30
  }
31
  const response = await fetch(url, {
32
    method: "DELETE",
33
    headers,
34
    body: undefined,
35
  });
36
  if (!response.ok) {
37
    const text = await response.text();
38
    throw new Error(`${response.status} ${text}`);
39
  }
40
  return await response.json();
41
}
42