Skip to main content

API Reference

All API endpoints are Vercel serverless functions located in the api/ directory. They follow RESTful conventions and use JSON for request/response bodies.

Base URL

Production: https://kinetic.email/api
Local: http://localhost:5173/api

Authentication

Most endpoints require a Supabase JWT in the Authorization header:

Authorization: Bearer <supabase-jwt>

See Authentication for details on obtaining and using tokens.

Common Response Patterns

Success

{
"success": true,
"data": { ... }
}

Error

{
"error": "Human-readable error message"
}

HTTP Status Codes

CodeMeaning
200Success
400Bad request (missing/invalid parameters)
401Unauthorized (missing or invalid JWT)
402Payment required (insufficient tokens)
403Forbidden (admin access required)
405Method not allowed
500Internal server error

Endpoint Summary

Public Endpoints

EndpointMethodAuthDescription
/api/track-pixelGETNoneTracking pixel for email opens/interactions (Edge runtime)
/api/track-amp-eventPOSTNoneAMP interaction event logging (Edge runtime)
/api/view-emailGETNoneHosted "View in Browser" page by send ID
/api/validate-ampPOSTNoneValidate AMP4Email HTML (CORS-restricted)
/api/blog-ogGETNoneDynamic Open Graph image generation

User Endpoints

EndpointMethodAuthTokensDescription
/api/gen/copyPOSTUserStage 1: finalized email copy (Claude Haiku)
/api/gen/blueprintPOSTUserStage 2: structural blueprint + design tokens (Claude Haiku)
/api/generatePOSTUserai_generationStage 3: full email code generation (RAG pipeline, Claude Sonnet)
/api/generate-emailPOSTUserai_generationSimple AI email generation / refine (no RAG)
/api/send-email-mailgunPOSTUserSend email via Mailgun (AMP support, suppression-checked)
/api/unsubscribePOSTUser or signed link tokenGlobal unsubscribe (Bearer session or HMAC link token)

Webhook Endpoints

EndpointMethodAuthDescription
/api/mailgun-webhookPOSTMailgun HMAC (required)Delivery events, bounces, complaints from Mailgun
/api/notify-signupPOSTx-webhook-secret headerSupabase Database Webhook → Telegram signup alert

Admin Endpoints

EndpointMethodAuthDescription
/api/admin/submit-contentPOSTAdminUpload content to RAG (Pinecone + Supabase)
/api/admin/update-contentPOSTAdminUpdate RAG content
/api/admin/delete-contentPOSTAdminDelete from RAG
/api/admin/list-contentGETAdminBrowse RAG library
/api/admin/rag-statsGETAdminRAG database statistics
/api/admin/auto-tagPOSTAdminAI content auto-tagging
/api/admin/evalGET/POSTAdminEval harness runs/results (createRun, saveResult, finalizeRun)
/api/eval/judgePOSTAdminLLM judge scoring for eval harness
/api/admin/submit-feedbackPOSTAdminSubmit generation feedback
/api/deploy-emailPOSTAdminDeploy showcase email HTML to production

CORS

API endpoints are restricted to the following origins:

https://kinetic.email
https://www.kinetic.email
http://localhost:5173
http://localhost:3000