API reference
Sitify's public API surface is small today and growing. This page documents what exists. A full REST + webhook API is on the roadmap; once it ships this page becomes the canonical reference.
Analytics ingestion
Tenants render on Sitify's tenant project; the tracking provider in the render layer posts events to the endpoint below. Custom analytics integrations can also POST directly.
POST /api/analytics/tenant
Hosted on the tenant project (sitify-tenant.vercel.app).
Body:
{
"subdomain": "yourname", // resolves the tenant
"pageType": "home", // home | plans | about | contact | faq | setup
"pagePath": "/",
"locale": "en",
"sessionId": "<uuid>", // client-generated, sessionStorage
"eventType": "view", // view | click_whatsapp | click_cta | time_spent | scroll_depth
"duration": 42, // seconds, only for time_spent
"scrollPercentage": 75, // 0..100, only for scroll_depth
"referrer": "https://...",
"userAgent": "...",
"deviceType": "mobile" // mobile | tablet | desktop | bot
}Response: { ok: true } on success. Errors return 4xx with { ok: false, error: <string> }.
CSV export
GET /api/analytics/tenant/export
Hosted on the dashboard project (app.sitify.ai). Authenticated session required; results are RLS-scoped to the caller's own tenants.
Query params:
site_id(required) — UUID of the tenantrange(optional) —24h | 7d | 30d | 90d | all; default30d
Response: text/csv with RFC 4180 escaping. Capped at 100,000 rows.
Per-tenant content (read-only)
GET /api/template-content/[template]
Hosted on the tenant project. Returns the active content rotation for a given template, mixing global library prompts with the calling tenant's brand-aware imagery.
Used by template showcase components; safe to call from your own client-side code if you want to mirror the showcase elsewhere.
Coming soon
On the roadmap, in approximate priority order:
- Tenant CRUD via API key (currently dashboard-only)
- Subscription / payment events as webhooks (Phase E)
- Provisioning webhook (Phase F — Xtream integration)
- Bulk pricing matrix update endpoint
- Analytics aggregates as JSON (currently CSV-only)
If you need an API surface that isn't here yet, tell us. We prioritize based on actual customer asks, not roadmap assumptions.
Authentication
Public endpoints (analytics ingestion, template content) take no auth — they're rate-limited and validate the subdomain server-side. Authenticated endpoints (CSV export, dashboard reads) use the same Supabase session as the dashboard; cookie-based, no API keys yet.
API keys arrive with the public Tenant CRUD API. They'll scope per tenant, expire on rotation, and live at /dashboard/sites/[slug]/settings/developer.