Withdrawal and deletion
Users can change their mind at any time. Withdrawal stops collection; deletion also removes what Relay holds.
From the browser
await relay.withdraw();
// Stops collection, clears the queue, cancels retries and revokes tokens.
const { deletionRequestId, notice } = await relay.requestDeletion();
// Withdraws, then deletes the contributor's stored contributions.withdraw() stops collection synchronously, before any network call, so nothing further is sent even if the request to Relay fails. Relay then revokes every outstanding contributor token. If the token has expired, the SDK proves identity with a fresh attestation instead.
From your backend
Use the server helper when the user isn't in the browser, for example when they delete their account.
import { createRelayServer } from "@relay/sdk/server";
const relay = createRelayServer({ secretKey: process.env.RELAY_SECRET_KEY!, endpoint: process.env.NEXT_PUBLIC_RELAY_ENDPOINT! });
await relay.withdraw({ subject: user.id });
await relay.requestDeletion({ subject: user.id });What deletion covers
Deletion removes the contributor's stored contributions from Relay and invalidates any generated exports that have not been delivered.
Relay cannot automatically recall data already delivered to a licensed recipient, or change models already trained on it. Affected deliveries are recorded so recipients can be notified. The consent screen tells users this before they opt in.