API routes
Every HTTP endpoint in the app.
POST /api/scrape/run
Runs the scrape pipeline for the given sources.
{
"platforms": ["tiktok", "instagram", "youtube"], // default: tiktok + instagram
"keywords": ["food", "fitness"], // optional, per-platform
"trending": true // optional
}| Field | Type | Description |
|---|---|---|
| totalStored | number | Rows upserted across all sources |
| totalCredits | number | ScrapeCreators credits spent |
| results[] | array | Per-source: items, credits, stored, top 3 |
POST /api/analyze
Analyzes a single video by URL. Costs 1 app credit (401 if signed out, 402 if out of credits).
{ "url": "https://www.tiktok.com/@creator/video/123…" }| Field | Description |
|---|---|
| video | Normalized + scored video with preview_url |
| benchmark | Avg like/comment/share rates of DB peers |
| percentile | Where it ranks vs peers in your DB |
| peerCount | How many peers it was scored against |
GET /api/cron/scrape
Daily cron entrypoint (06:00 UTC, configured in vercel.json). Re-scrapes trending + every niche present in the DB. Requires the Authorization: Bearer $CRON_SECRET header — Vercel sends it automatically for cron invocations.
GET /auth/callback
OAuth callback. Exchanges the Supabase auth code for a session and redirects to /platform.