Skip to content
Menu

Data and privacy

User data deletion

Markdown version

Delete a user's SDK data on the device with wipeData, what the SDK stores in Herald for a user, and how to erase it there with the deletion API.

Deleting a user's data has two halves: the data the SDK keeps on the device, and the data Herald received from it. The SDK handles the first with one call. Your backend handles the second with one API call.

On the device

wipeData() deletes everything the SDK stored in your app: the event queue, the External ID and user token, content cards, in-app messages, in-app history, the cached push token and the device ID. It does not touch your app's own data or the operating system's notification settings.

swift
func accountDeleted() {
    Herald.shared.wipeData()
    // The SDK is now off. If the app keeps running signed out and collection may resume:
    Herald.shared.setEnabled(true)
}
  • After the wipe the device gets a new device ID, so later activity cannot be linked to the deleted user on this device.
  • Events still queued are deleted, not sent.
  • The SDK stays off until you call setEnabled(true).
  • wipeData() only affects the device it runs on. A user with the app on two phones needs it on both, or the server-side deletion API below.

Use reset() for an ordinary sign-out. It clears the user from the device but keeps the device ID and the device's own history. See Users and identity.

In Herald

For an identified user, Herald stores:

DataComes from
User profile: traits and attributesidentify, setAttributes, and any warehouse sync you run
Events: tracks, screens, purchases, sessions, interactions, with the device IDEvery batch
Device record: latest device context, country, the location you set, and the user it belongs toEvery batch
Contact points: email, phone, push tokenssetEmail, setPhone, push token registration
SuppressionsUnsubscribes, bounces and complaints
Content card and in-app message records, with viewed, clicked and dismissed timesAgent sends and interactions
Decisions and outcomesHerald's agents

Anonymous activity (before sign-in, or after reset()) is stored with the device ID and no External ID.

Delete a user in Herald

Call the deletion API from your backend, for privacy requests such as GDPR and CCPA erasure.

DELETE /api/v1/users/{userId}

HeaderValue
AuthorizationBearer <ingest token>, the ingest token of your SDK connection

userId is the ID your app passes to identify, URL-encoded, 1 to 255 characters. The call deletes data held for the connection whose token you send. A user known to several connections needs one call per connection.

shell
curl -X DELETE "https://YOUR_HERALD_HOST/api/v1/users/u_123" \
  -H "Authorization: Bearer $HERALD_INGEST_TOKEN"
json
{
  "data": {
    "userId": "u_123",
    "sdkDevices": 2,
    "sdkEvents": 418,
    "sdkMessages": 6,
    "contactPoints": 3,
    "outboundMessages": 1,
    "userArmStats": 4,
    "userAgentAssignments": 1,
    "pseudonymizedDecisions": 12,
    "failedSendsScrubbed": 0,
    "trackedUser": "deleted"
  }
}

Never call this from the app: the ingest token is a server secret.

What is deleted

DataResult
Device records of the user's devices: devices bound to the user now, and devices the user was signed in on before, including after reset()Deleted (sdkDevices)
Content card and in-app message recordsDeleted (sdkMessages)
Events stored with the External ID, anonymous events from those devices (before sign-in and after reset()), and events that claimed the External ID without a verified user tokenDeleted (sdkEvents)
Contact points: email, phone, push tokensDeleted (contactPoints)
Queued and sent pushes and emails for the userDeleted (outboundMessages)
Per-user agent learning state and agent assignmentsDeleted (userArmStats, userAgentAssignments)
Campaign recipient records for the connection's campaigns, and segment membershipDeleted
Failed-send recordsThe External ID is removed; a record left with no users is deleted (failedSendsScrubbed)
User profile: traits and attributestrackedUser is deleted when nothing else references the user. It is cleared when it must stay for another source, such as a warehouse sync: attributes, time zone and computed profile fields are emptied. It is none when there was no profile, or when this connection held no data about the user; the profile is then left as it is.

What is kept, and why

  • Decisions, with the External ID replaced. Herald's agents learn from past decisions and outcomes. Each decision's External ID becomes a one-way pseudonym, deleted: followed by a keyed hash of the connection and External ID, so the row no longer identifies the person. pseudonymizedDecisions counts them.
  • Suppressions. An unsubscribe, bounce or complaint is stored against the address, not the External ID, and stays so Herald does not contact that address again. If you delete a user who unsubscribed, the address stays suppressed.
  • Data from other sources. Rows that belong to other connections, to Braze-sent decisions and to warehouse syncs are not part of this connection's data. Delete them in those systems.

Repeat calls and errors

The call is idempotent. Repeating it returns zero counts and trackedUser none: the first call already handled the profile, and the repeat finds no data for the connection, so it leaves the profile alone. It returns 200 for a user Herald has never seen.

StatusBody errorCause
200Done, including when there was nothing to delete
400userId must be 1 to 255 charactersBad External ID
401UnauthorizedMissing or unknown ingest token
403ForbiddenThe connection is inactive, or its type does not take contacts
403User deletion needs an SDK connection's ingest tokenThe token belongs to a connection that is not an SDK connection, such as SendGrid
500Internal server errorServer failure. Retry.

A user who opens the app again after deletion creates new data. Call wipeData() on the device first, so nothing new arrives while you process the request.

Smaller steps

To stop sending without a full deletion, remove addresses with DELETE /api/v1/contacts. It takes the same body as POST /api/v1/contacts: a list of userId, kind (email, phone, apns, fcm, webpush) and value. See SDK REST endpoints.

Retention

Herald keeps SDK data until you delete it with the API above. There is no automatic expiry today. Tell your account team if your retention policy needs one.

See Herald decide live →