# Identifiers (/docs/typescript/guides/identifiers)



Every scan method accepts an optional `cuid` — a stable identifier for the
user or event the scan belongs to.

```ts
await tawa.analyze(userInput, { cuid: "u_9f2c1a7b3e" });
```

## What to pass [#what-to-pass]

The identifier just needs to be **stable** for a given user or event — the
same user should map to the same value across requests.

* A UUID attached to a user, session, or event, **or**
* *(recommended)* a **hash of identifying metadata**, so you never expose
  your internal UUIDs or any user data.

<Callout type="warn">
  **Never pass raw PII.** Don't send emails, names, phone numbers, or any
  personal data as the identifier — always hash or otherwise obfuscate it
  first.
</Callout>

### Hashing example [#hashing-example]

Hash a user id (with a server-side salt) into an opaque, stable identifier:

```ts
import { createHash } from "node:crypto";

function toCuid(userId: string) {
  return createHash("sha256")
    .update(`${userId}:${process.env.TAWA_ID_SALT}`)
    .digest("hex")
    .slice(0, 32);
}

await tawa.analyze(userInput, { cuid: toCuid(currentUser.id) });
```

## Multi-tenant apps [#multi-tenant-apps]

If you're building on behalf of multiple end customers, pass `tenantId`
alongside `cuid` to scope the identifier to a specific tenant:

```ts
await tawa.analyze(userInput, { cuid: "u_9f2c1a7b3e", tenantId: currentTenant.id });
```
