{"message":"Marketing Agent API - Unified Server","status":"Server is running successfully","timestamp":"2026-10-07T02:34:21.715Z","version":"2.0.0","availableEndpoints":{"GET /":"This welcome message","GET /health":"Health check endpoint","GET /api/auth/me":"Return the authenticated Clerk user profile","GET /api/posts":"Get all posts (requires Clerk authentication or legacy x-user-id header)","GET /api/posts/:id":"Get single post by ID (requires Clerk authentication or legacy x-user-id header)","POST /api/posts":"Create new post (requires Clerk authentication or legacy x-user-id header)","POST /api/posts/generate":"Generate new post with AI (requires Clerk authentication or legacy x-user-id header)","POST /api/posts/update":"Update existing post with AI (requires Clerk authentication or legacy x-user-id header)","PUT /api/posts/:id":"Update post by ID (requires Clerk authentication or legacy x-user-id header)","DELETE /api/posts/:id":"Delete single post by ID (requires Clerk authentication or legacy x-user-id header)","DELETE /api/posts/batch":"Delete multiple posts (requires Clerk authentication or legacy x-user-id header)","DELETE /api/posts":"Delete all posts with ?confirm=true (requires Clerk authentication or legacy x-user-id header)","GET /api/analytics/list-files":"List all files from S3 folders (requires Clerk authentication or legacy x-user-id header)","POST /api/analytics/upload-file":"Upload file to uploaded_kb_files folder (requires Clerk authentication or legacy x-user-id header)","GET /api/analytics/fetch-files":"Fetch latest files from S3 (requires Clerk authentication or legacy x-user-id header)","GET /api/analytics/generate-context":"Generate AI analysis context file (requires Clerk authentication or legacy x-user-id header)","GET /api/analytics/context-content":"Get latest AI context content (requires Clerk authentication or legacy x-user-id header)","GET /api/analytics/data":"Fetch data from external API (no authentication required)","POST /api/ai/ask":"Ask a question to Claude AI (requires Clerk authentication or legacy x-user-id header)","POST /api/ai/chat":"Chat with Claude AI with conversation history (requires Clerk authentication or legacy x-user-id header)","POST /api/ai/posttoemail":"Convert a LinkedIn post to a marketing email (requires Clerk authentication or legacy x-user-id header)","POST /api/ai/news-gathering":"Gather latest marketing news for the user's company using AI web search (requires Clerk authentication or legacy x-user-id header)","POST /api/company/research":"Research company information using OpenAI with web search (requires Clerk authentication or legacy x-user-id header)","GET /api/company/research":"Get all saved company research for user (requires Clerk authentication or legacy x-user-id header)","GET /api/company/research/:id":"Get specific company research by ID (requires Clerk authentication or legacy x-user-id header)","PUT /api/company/research/:id":"Update company research description (requires Clerk authentication or legacy x-user-id header)","DELETE /api/company/research/:id":"Delete company research by ID (requires Clerk authentication or legacy x-user-id header)","POST /api/company/openai-news-gathering":"Gather latest news for the user's company using OpenAI (uses most recent company research) (requires Clerk authentication or legacy x-user-id header)","POST /api/competitors/find-competitors":"Find top 3 competitors using Claude AI based on user's company info (requires Clerk authentication or legacy x-user-id header)","GET /api/competitors":"Get all saved competitor analyses for user (requires Clerk authentication or legacy x-user-id header)","POST /api/self-linkedin-analysis/analyze":"Analyze LinkedIn posts using Claude AI with extended thinking (requires Clerk authentication or legacy x-user-id header)","GET /api/self-linkedin-analysis":"Get all saved LinkedIn analyses for user (requires Clerk authentication or legacy x-user-id header)","POST /api/competitive-analysis/analyze":"Perform comprehensive competitive intelligence analysis using Claude AI with extended thinking (requires Clerk authentication or legacy x-user-id header)","GET /api/competitive-analysis":"Get all saved competitive analyses for user (requires Clerk authentication or legacy x-user-id header)","GET /api/competitive-analysis/:id":"Get specific competitive analysis by ID (requires Clerk authentication or legacy x-user-id header)","DELETE /api/competitive-analysis/:id":"Delete competitive analysis by ID (requires Clerk authentication or legacy x-user-id header)","GET /api/linkedin/start":"Begin LinkedIn OAuth (requires Clerk authentication or legacy x-user-id header)","GET /api/linkedin/callback":"LinkedIn OAuth callback","DELETE /api/linkedin/disconnect":"Remove LinkedIn OAuth credentials (requires Clerk authentication or legacy x-user-id header)","GET /api/user/onboarding-status":"Check if user has completed onboarding (requires Clerk authentication or legacy x-user-id header)","POST /api/user/onboarding":"Set user onboarding completion status (requires Clerk authentication or legacy x-user-id header)","POST /api/user/linkedin-org":"Set user's LinkedIn organization ID (requires Clerk authentication or legacy x-user-id header)","POST /api/suggestions/generate":"Generate marketing post suggestions based on company research (requires Clerk authentication or legacy x-user-id header)","POST /api/suggestions/generate-from-db":"Generate marketing post suggestions using data from database - fetches most recent company research (requires Clerk authentication or legacy x-user-id header)","POST /api/knowledge/chat":"Query knowledge base with prompt injection protection (requires Clerk authentication or legacy x-user-id header)","POST /api/knowledge/query":"Query knowledge base (alias for /chat) with prompt injection protection (requires Clerk authentication or legacy x-user-id header)","POST /api/article-scrapper/extract":"Extract article content from URL using Postlight/Mercury parser (requires Clerk authentication or legacy x-user-id header)","POST /api/article-extractor/extract":"Extract article content from URL using Extractus article extractor (requires Clerk authentication or legacy x-user-id header)","POST /api/readability/extract":"Extract article content from URL using Mozilla Readability (requires Clerk authentication or legacy x-user-id header)","POST /api/brightdata/extract":"Extract article content from URL using Bright Data Web Unlocker (requires Clerk authentication or legacy x-user-id header, requires BRIGHT_DATA_API_KEY env var)","POST /api/zyte/extract":"Extract article content from URL using Zyte API (requires Clerk authentication or legacy x-user-id header, requires ZYTE_API_KEY env var)","POST /api/brightdata-scraper/linkedin":"Orchestrated LinkedIn company scraping with BrightData (trigger, poll, download) (requires Clerk authentication or legacy x-user-id header, requires BRIGHT_DATA_API_KEY env var)"},"notes":["Most endpoints now use Clerk for authentication but also accept the legacy 'x-user-id' header","Health check and external data endpoints do not require authentication","API endpoints are prefixed with /api"]}