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

# Mint Web Tracking Identity

> Mint a short-lived proof that lets the browser SDK attach events to one authenticated contact

Call this endpoint from your authenticated backend after you know the current
user's email. It returns a short-lived token bound to the workspace, web
tracking key, normalized email, and expiry.

Never call this endpoint from browser code or expose the secret API key used to
authorize it. A publishable tracking key alone may append anonymous activity,
but cannot attach events to a subscriber or trigger automation.

If the email is not yet a contact in your workspace, minting creates one so the
identified events have somewhere to land - otherwise they would be accepted and
then silently dropped. The contact is created active with no list memberships
and without triggering any automations; enroll it through your usual flows when
you want more than event attribution. If the email cannot be added as a contact
(for example a suppressed or undeliverable address), the request fails with a
400 and no token is minted.

Requires `commerce:write`, `automations:trigger`, and `subscribers:write` (minting can create the contact).

## Request

Identify the key by either `keyId` or `publicKey`. The publishable key is the
value in your snippet and in the dashboard, so it is usually the one your
backend already has.

<ParamField body="publicKey" type="string">
  Publishable key value (`seq_pk_...`) of an active web tracking key. Provide
  this or `keyId`.
</ParamField>

<ParamField body="keyId" type="string">
  Internal ID of an active web tracking key. Provide this or `publicKey`.
</ParamField>

<ParamField body="email" type="string" required>
  Email of the user authenticated by your backend. It is normalized to
  lowercase.
</ParamField>

<ParamField body="ttlHours" type="number">
  Token lifetime from 1 minute through 30 days. Defaults to 24 hours. Mint a
  fresh token when the user signs in or reaches checkout; request a longer
  lifetime only when re-minting is genuinely impossible.
</ParamField>

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/web-tracking-identities" \
  -H "Authorization: Bearer YOUR_SECRET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "publicKey": "seq_pk_your_key",
    "email": "buyer@example.com"
  }'
```

Pass the returned token to the browser and identify the same email:

```javascript theme={null}
sequenzy.identify("buyer@example.com", response.identityToken);
```

## Response

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "keyId": "wtk_abc123",
    "publicKey": "seq_pk_your_key",
    "email": "buyer@example.com",
    "subscriberId": "sub_abc123",
    "identityToken": "seq_wid_...",
    "expiresAt": "2026-08-18T12:00:00.000Z"
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Provide keyId or publicKey"
  }
  ```

  ```json 400 (email rejected) theme={null}
  {
    "error": "This email cannot be added as a contact, so an identity cannot be minted for it"
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Active web tracking key not found"
  }
  ```
</ResponseExample>
