Turn off one email preference with the token from a mail
const url = 'https://example.com/v1/notifications/unsubscribe';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"token":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/notifications/unsubscribe \ --header 'Content-Type: application/json' \ --data '{ "token": "example" }'The link in a notification mail (and its List-Unsubscribe header) carries a token
signed for one preference of one member of one organization. The
verified token is the only credential: no cookie or key is read, so there is no
CSRF header either. Send {"token": "..."} as JSON (the web app’s confirmation
page), or the one-click form List-Unsubscribe=One-Click with the token
in the query, as mail clients do. Sending the same token again changes nothing.
A forged token, one for someone who left the organization, and one from a mail
older than the person’s last change all answer 400 notifications.tokenInvalid.
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”The token
Request Body
Section titled “Request Body”object
Example generated
{ "token": "example"}object
Responses
Section titled “Responses”The preference is off
object
Example
{ "preference": "findings"}Notifications.tokenInvalid, or request.invalidJson
Over the operation’s rate-limit budget (x-affectra-budget): code request.rateLimited with params.budget. Wait Retry-After seconds before trying again.
Every error answer, Content-Type
application/problem+json. The web app and integrations translate code; detail is English,
for people reading curl output or CI logs, and may change wording at
any time. Match on code, never on detail.
object
The HTTP status
Stable error codes. A code is never renamed; new ones may be added, so
a client falls back to detail for a code it doesn’t know. Another
organization’s object answers notFound, the same as a missing one.
What went wrong
Values the code’s message needs, e.g. {“field”: “version”}. Only values the caller sent or may see. Empty when the message needs none.
object
Example
{ "code": "notFound"}Headers
Section titled “Headers”Seconds until a request would be allowed again, at least 1
Notifications.unavailable (no database or no unsubscribe key)