Engineering manualAPI route source
/api/brands/social-changes
Exact current route handler: hosted-app/app/api/brands/social-changes/route.js
Methods: GET. Input signals: query parameters. Literal response-status signals: none detected.
Source: hosted-app/app/api/brands/social-changes/route.js. Imports: ../../../../lib/comprehensive-pull.mjs, ../../../../lib/social-changes.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
// GET /api/brands/social-changes?domain= — the brand's latest two finished
// reports that read its social accounts, and what changed between them: new
// posts, profile counts and engagement on posts seen both times. Sessions and
// API keys with read_reports. Reads saved reports only. See
// lib/social-changes.mjs.
import { NextResponse } from "next/server";
import { supabaseConfigFromEnv } from "../../../../lib/supabase-rest.mjs";
import { bearerTokenFromHeader } from "../../../../lib/comprehensive-pull.mjs";
import { getSocialChanges } from "../../../../lib/social-changes.mjs";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export const maxDuration = 30;
const PRIVATE = { "cache-control": "private, no-store", "x-content-type-options": "nosniff" };
export async function GET(request) {
const result = await getSocialChanges({ token: bearerTokenFromHeader(request.headers.get("authorization")), config: supabaseConfigFromEnv(process.env), domain: new URL(request.url).searchParams.get("domain") || "" });
return NextResponse.json(result.body, { status: result.http_status, headers: PRIVATE });
}