Engineering manualAPI route source
/api/notifications/unsubscribe
Exact current route handler: hosted-app/app/api/notifications/unsubscribe/route.js
Methods: GET, POST. Input signals: query parameters. Literal response-status signals: none detected.
Source: hosted-app/app/api/notifications/unsubscribe/route.js. Imports: ../../../../lib/notification-preferences.mjs, ../../../../lib/supabase-rest.mjs, next/server. Exact source is shown for inspection; its presence does not prove authentication, validation or live behavior.
All API routes · API and execution contract
import { NextResponse } from 'next/server';
import { supabaseConfigFromEnv } from '../../../../lib/supabase-rest.mjs';
import { unsubscribeNotification } from '../../../../lib/notification-preferences.mjs';
export const runtime = 'nodejs';
export const dynamic = 'force-dynamic';
const headers = { 'cache-control': 'private, no-store', 'referrer-policy': 'no-referrer', 'x-content-type-options': 'nosniff' };
export async function GET() {
// Link scanners must not unsubscribe on GET; explicit form submission required.
return new Response('<!doctype html><meta name="referrer" content="no-referrer"><title>Stop Brand Studio emails</title><form method="post"><button type="submit">Stop monitoring emails</button></form>', { headers: { ...headers, 'content-type': 'text/html; charset=utf-8', 'content-security-policy': "default-src 'none'; form-action 'self'; frame-ancestors 'none'" } });
}
export async function POST(request) {
const result = await unsubscribeNotification({ token: new URL(request.url).searchParams.get('token'), config: supabaseConfigFromEnv(process.env) });
return NextResponse.json(result.body, { status: result.http_status, headers });
}