Introduction
The AdRecon API provides serverless endpoints for media proxying, page capture, user management, and payment integration. All endpoints are hosted on Vercel and interact with Supabase for authentication and data persistence.Base URL
All API endpoints are relative to your deployment domain:Authentication
Most endpoints require authentication using Supabase access tokens via theAuthorization header:
Getting an Access Token
Tokens are obtained through Supabase Auth:Admin Access
Certain endpoints require admin privileges. Admin users are identified by:403 Forbidden when accessing admin endpoints.
Error Handling
All error responses follow a consistent JSON structure:Common HTTP Status Codes
| Status | Meaning | Common Causes |
|---|---|---|
400 | Bad Request | Missing required parameters, invalid URL format |
401 | Unauthorized | Missing or invalid bearer token |
403 | Forbidden | Valid auth but insufficient permissions (non-admin) |
405 | Method Not Allowed | Wrong HTTP method (check Allow header) |
415 | Unsupported Media Type | Content-Type mismatch for media proxy |
429 | Too Many Requests | Rate limit exceeded (includes Retry-After header) |
500 | Internal Server Error | Unexpected server-side failure |
502 | Bad Gateway | Upstream service failure |
504 | Gateway Timeout | Request exceeded timeout limits |
Rate Limiting
Endpoints that perform expensive operations enforce rate limits:- Page Ripper: 10 captures per user per 15-minute window
- Rate-limited responses include a
Retry-Afterheader (seconds until reset)
CORS and Security
CORS Support
All endpoints supportOPTIONS preflight requests and include appropriate CORS headers for browser-based clients.
SSRF Protection
Endpoints that fetch external URLs implement multiple layers of SSRF protection:- Host allowlists — Only whitelisted domains accepted
- IP blocklists — Private/internal IP ranges rejected
- DNS resolution checks — Prevents DNS rebinding attacks
- Post-redirect validation — Final URL re-checked after redirects
Content Types
Request Content-Type
MostPOST endpoints expect JSON:
Response Content-Type
- JSON endpoints:
application/json - Media proxy:
image/*,video/*, etc. (pass-through from upstream) - Page Ripper:
application/zip
Caching
Media Proxy Caching
The/api/ad-media endpoint passes through upstream Cache-Control headers. When upstream omits caching directives, fallback policies apply:
- Images:
public, max-age=1800, s-maxage=21600(30 min / 6 hours) - Videos:
public, max-age=600, s-maxage=3600(10 min / 1 hour)
Admin Endpoints
All admin endpoints return:Supported Authentication Methods
Email Magic Link
Passwordless login via one-time email link
Google OAuth
Social authentication with Google accounts
Environment Variables
Server-side endpoints reference these variables:| Variable | Purpose | Required |
|---|---|---|
SUPABASE_URL | Supabase project URL | Yes |
SUPABASE_SERVICE_ROLE_KEY | Server-side auth key | Yes (admin endpoints) |
FANBASIS_API_KEY | Fanbasis integration key | No (payment features only) |
Next Steps
Media Proxy
Proxy Facebook/Instagram media assets
Page Ripper
Capture landing pages as ZIP archives
Admin Users
Manage user accounts and permissions
Fanbasis Integration
Payment webhooks and offer management