/api/v1/account/unsubscribeUnsubscribe from notification emails (HTML page)
One-click email unsubscribe via signed token. No auth; returns an HTML page (text/html), never JSON. Requires `token` + `uid` query params; `type` defaults to 'all'. The token is HMAC-SHA256 of `<uid>:<type>` keyed on `EVALGUARD_ENCRYPTION_KEY`, compared with `crypto.timingSafeEqual`. Writes `profiles.notification_preferences.email` through a service-role client: `type=all` clears every email preference, any other `type` clears that one key (rejected unless it matches `^[a-z0-9_]+$` case-INsensitively and is not a prototype key). A missing `token`/`uid` is a 400; a tampered or unverifiable token is a 403. Authentication: the signed `token` query parameter (the UnsubscribeToken scheme), an HMAC over `<uid>:<type>` that EvalGuard mints into its own e-mails. No `eg_` API key is read and no API-key scope is evaluated; a missing or tampered token is a 403.
Authentication
Signed unsubscribe link. Pass the token query parameter: HMAC-SHA256 of <uid>:<type> keyed with the deployment's EVALGUARD_ENCRYPTION_KEY.
This is the signed link EvalGuard puts in its own e-mails for CAN-SPAM / GDPR / CASL compliance, not a credential you mint. No eg_ API key is read and a missing or tampered token is a 403.
Parameters
token in queryrequiredHMAC-SHA256(uid:type) unsubscribe token (constant-time verified).
stringuid in queryrequiredUser id the token was issued for. 400 if missing.
stringtype in queryNotification category to unsubscribe; 'all' disables every email.
stringResponse
All status codes
Code samples
cURL
curl -X GET \ https://evalguard.ai/api/v1/account/unsubscribe \ -H "Authorization: Bearer $EVALGUARD_API_KEY"
TypeScript
// The TypeScript SDK (@evalguard/sdk) exposes TYPED methods — runEval,
// getEval, runSecurityScan, checkFirewall, … — not a generic request().
// For an arbitrary endpoint, call it directly:
const res = await fetch("https://evalguard.ai/api/v1/account/unsubscribe", {
method: "GET",
headers: { Authorization: `Bearer ${process.env.EVALGUARD_API_KEY}` },
});
console.log(res.status, await res.json());Python
# The Python SDK (pip install evalguardai) exposes TYPED methods on
# EvalGuardClient — run_eval, get_eval, … — not a generic request().
# For an arbitrary endpoint, call it directly:
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['EVALGUARD_API_KEY']}"}
response = requests.request("GET", "https://evalguard.ai/api/v1/account/unsubscribe", headers=headers)
print(response.status_code, response.json())Go
package main
import (
"context"
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequestWithContext(context.Background(), "GET", "https://evalguard.ai/api/v1/account/unsubscribe", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
fmt.Println(resp.Status)
}