Concepts
Each site or app is an app in Settings → Apps, with an app id (such as pidgefit-ios), push credentials, identity keys and client keys.
Client keys
Section titled “Client keys”The SDK uses a client key (mpck_…), safe to ship: it can record events, register devices and record consent, nothing else.
| Platform | Bound to | Checked with |
|---|---|---|
| Web | Site origins | Origin |
| iOS, macOS | Bundle ids | App Attest |
| Android | Package names | Play Integrity |
SDKs send their version. Below an app’s minimum version: 426 sdk_upgrade_required.
Users and subscriptions
Section titled “Users and subscriptions”| Term | Meaning | Limit |
|---|---|---|
| User | A person, identified by your user id (externalUserId) |
|
| Alias | Another id for the user, such as a CRM id | 10 per user |
| Subscription | One way to reach the user: a device’s push token, an email address or a phone number | 20 per user; the oldest is dropped, but the newest 3 email and 3 SMS are kept |
| Tag | Key-value pair for segments, such as plan: "pro" |
Before sign-in the SDK uses an anonymous id. identify links it and the device to the user; reset on sign-out unlinks the device.
Consent
Section titled “Consent”The OS notification permission is not consent to marketing. Record the user’s answer with setChannelConsent:
| Field | Values |
|---|---|
channel |
email, push, sms, in_app |
topicKey |
Optional, such as promotions |
status |
opted_in or opted_out |
consentLanguageShown |
The text the user agreed to (required for opted_in) |
Marketing goes only to opted-in users; transactional messages don’t need it. To hold all network calls until users accept your terms, call setConsentRequired(true) before configure and setConsentGiven(true) after.
Identity verification
Section titled “Identity verification”Stops someone with your client key from claiming another user’s id. Your server signs a token; the app passes it to identify.
- Add an ES256 public key in Settings → Apps → your app → Identity keys.
- Sign a JWT on your server:
| Claim | Value |
|---|---|
alg / kid (header) |
ES256 / your key id |
iss |
The app id |
identity.external_id |
The user’s id |
iat, exp |
exp at most 30 days after iat; 60 s clock skew |
import { SignJWT, importPKCS8 } from 'jose'
const privateKey = await importPKCS8(process.env.MAILPIDGE_IDENTITY_PRIVATE_KEY!, 'ES256')
export const createMailPidgeIdentityToken = (userId: string) => new SignJWT({ identity: { external_id: userId } }) .setProtectedHeader({ alg: 'ES256', kid: 'es256-2027-01' }) .setIssuer('pidgefit-ios') .setIssuedAt() .setExpirationTime('1h') .sign(privateKey)| Error | Cause |
|---|---|
identity_verification_required |
The app requires a token and none was sent |
identity_verification_failed |
The token is invalid or expired |
Refresh: register the SDK’s token refresh listener. On expiry it asks your app for a new token and resumes queued requests; if that token fails too, the queue fails instead of retrying forever.
Erasure
Section titled “Erasure”Deleting a user removes their subscriptions, events, feed and consent records. Also call reset on their devices.