questionnaire docs
Development

API Routes

Server API endpoints for client-side data fetching.

API Routes

All API routes live in app/api/ and require the x-tenant-id header set by proxy.js.

Endpoints

RouteMethodReturns
/api/category/[slug]GETCategory JSON with KV-encoded ad config
/api/article/[slug]GETArticle JSON with KV-encoded ad config
/api/questionnaire?slug=GETQuestionnaire questions (fallback to default)
/api/whatsapp?categorySlug=GETWhatsApp theme steps and config

Request flow

Static routes

RoutePurpose
/ads.txtPer-tenant ads.txt content
/sw.jsService worker (PushAlert + Taboola)

Services layer

API routes delegate to lib/services/:

ServiceModel
tenant.jsTenant
category.jsCategory
article.jsArticle
questionnaire.jsQuestionnaire
whatsapp-theme.jsWhatsAppTheme
articleHome.jsArticleHome

All services encode KV values via lib/utils/kvEncoding.js before returning.

On this page