Templates
Admin template catalog + per-template language metadata.
List templates (paginated)
Returns templates enriched with S3 metadata (subject/sender/topics). Supports topic and free-text search. Optional `withTopicSync=true` backfills topics from S3 into the DB. Requires Admin or TrialAdmin role.
Toggle template enabled/disabled
Flips the `is_enabled` flag for the given template id. Requires Admin or TrialAdmin role.
List topics with template counts
Returns each topic with its total and enabled template counts. Requires Admin or TrialAdmin role.
Get template (or feedback) JSON
Returns the resolved template payload from S3 for the requested language. `mode=feedback` returns the post-swipe feedback variant. Requires Admin or TrialAdmin role.
List available languages for a template
Returns one entry per language with `hasFeedback` set from a runtime S3 HeadObject. The DB column alone is not trustworthy (a CHECK constraint forces it non-null even when the S3 file does not yet exist). Requires Admin or TrialAdmin role.
Bulk enable/disable templates by topic
Flips `is_enabled` for every template linked to the given topic. Requires Admin or TrialAdmin role.
Get template JSON (public)
Returns the resolved template JSON (and optional feedback) for the calling tenant. Supports `If-None-Match` against the per-language ETag for 304 responses. **Note:** not currently mounted in `routes/index.js` — kept here so the spec mirrors source. Requires `X-Tenant-Id` but no bearer token.