Home Bento Dynamic API Reference
The existing banner endpoints the home bento relies on, the corrected serve response shape, tracking payloads, and integrator guardrails.
Audience: storefront and admin integrators. This feature adds no endpoint, DTO or error code. This page reproduces the existing contract the bento depends on. Full banner endpoint documentation is in Banners API.
Route Surfaces
| Surface | Prefix | Auth |
|---|---|---|
| Customer serve | /api/mobile/banners/serve/:slug | @Public(), RATE_LIMITS.PUBLIC_HIGH_FREQUENCY |
| Customer tracking | /api/mobile/banners/events/* | @Public(), RATE_LIMITS.PUBLIC_TRACKING_EVENT, 202 |
| Storefront tracking BFF | /api/store/banners/events/* | Same-origin, always 202 |
| Admin placements | /api/admin/placements | JWT + Placements_READ / _CREATE / _UPDATE |
| Admin banners | /api/admin/banners | JWT + banners read permission |
| Admin analytics | /api/admin/banner-analytics/stats, /events | JWT + BANNER_ANALYTICS_READ |
Endpoint Reference
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/mobile/banners/serve/:slug | Public | Banners for one placement. The bento calls it once per slug, seven times per render. |
| POST | /api/mobile/banners/events/impression | Public | Record an impression. 202. |
| POST | /api/mobile/banners/events/click | Public | Record a click. 202. |
| POST | /api/store/banners/events/impression | Same-origin | Storefront BFF; forwards to the backend, always answers 202. |
| POST | /api/store/banners/events/click | Same-origin | Storefront BFF; same behavior. |
| GET | /api/admin/placements | Placements_READ | List placements. Query page, size (max 100). |
| POST | /api/admin/placements | Placements_CREATE | Create a placement. |
| PATCH | /api/admin/placements/:publicId | Placements_UPDATE | Update a placement. Still accepts slug; the admin edit dialog does not send it. |
| PATCH | /api/admin/placements/:publicId/deactivate | Placements_UPDATE | Deactivate a placement. Used to retire home_hero, home_promo_left, home_promo_right. |
| GET | /api/admin/banners | banners read | List banners. Same list query. |
| GET | /api/admin/banner-analytics/stats | BANNER_ANALYTICS_READ | Daily rollup (UTC). |
| GET | /api/admin/banner-analytics/events | BANNER_ANALYTICS_READ | Raw events, same day. Query bannerPublicId, placementPublicId, campaignPublicId, from, to (range at most 90 days). |
Key Contracts
Serve response
GET /api/mobile/banners/serve/home_bento_4
{
"message": "Banners served successfully",
"errorCode": null,
"data": {
"placement": {
"placementPublicId": "01a11d4c-0000-7000-8000-000000000004",
"slug": "home_bento_4",
"label": "Homepage Bento — Middle row, wide",
"layoutType": "inline_card",
"maxBanners": 1,
"allowPartialRender": true,
"fallbackPlaceholderUrl": null
},
"banners": [
{
"publicId": "01a11d6b-173d-7579-8a3e-c39dbe09ba68",
"campaignPublicId": "01a11d6b-8ee5-764e-bbb4-d26b19f956bb",
"title": "Verify Bento Wide Banner",
"primaryImageUrl": "public/landing/yhfQZjverify-banner.webp",
"primaryImageAlt": "Drone product promo",
"mobileImageUrl": null,
"videoUrl": null,
"mediaVariants": null,
"headline": "Drone product promo",
"subheadline": null,
"ctaLabel": null,
"ctaUrl": "/search?q=test",
"target": null,
"ctaOpenNewTab": false,
"utmSource": null,
"utmMedium": null,
"utmCampaign": null,
"utmContent": null,
"bgColor": "#112233",
"transitionDurationMs": null,
"isFallback": false,
"displayOrder": 0
}
],
"items": [],
"servedAt": "2026-10-09T03:15:00.000Z"
}
}Notes:
- The envelope timestamp is
servedAt. There is nogeneratedAt, and the slot list isitems, notslots. - The example is illustrative. Field names and types come from
BannerServeResponseDtoandBannerServeItemDto; the placement id, image key, and timestamp values are sample data. TheprimaryImageUrlis shown as a storage key because the backend stores a key; the storefront resolves it against the asset origin. ctaUrlarrives already resolved (override, then target URL, then stored). Do not rebuild a URL fromtarget.slug.- An active placement with nothing eligible returns
"banners": []. - Serve responses are cached in Redis for
BANNER_SERVE_CACHE_TTL_SECONDS(default 60).
Tracking payload
Sent by the storefront to POST /api/store/banners/events/impression and /click, then forwarded.
{
"bannerPublicId": "01a11d6b-173d-7579-8a3e-c39dbe09ba68",
"placementPublicId": "01a11d4c-0000-7000-8000-000000000004",
"campaignPublicId": "01a11d6b-8ee5-764e-bbb4-d26b19f956bb",
"occurredAt": "2026-10-09T03:16:02.000Z",
"correlationId": "clk_01a11d6b-173d-7579-8a3e-c39dbe09ba68_1791515762000"
}Backend answer: HTTP 202 with "message": "Impression recorded." or "Click recorded." and data: null. bannerPublicId and placementPublicId are required UUIDs; campaignPublicId is optional. The global pipe rejects unknown fields (400), so a partial or extra body is a swallowed 400 at the BFF. Dedupe is by correlationId.
Placement seed row
Shape written by seedPlacements (not an HTTP call):
{
"slug": "home_bento_4",
"label": "Homepage Bento — Middle row, wide",
"layoutType": "inline_card",
"pageContext": "/",
"maxBanners": 1,
"allowPartialRender": true,
"sortOrder": 13,
"recommendedWidth": 2048,
"recommendedHeight": 1024,
"recommendedAspectRatio": "2:1",
"notes": "Hero bento card 4 (row2.wide). One banner shows; lowest display order, then highest weight, wins. Copy is baked into the image — keep text in the centre safe area. Do not rename this slug: the storefront requests it by name. Campaigns here must not use device/login/new-visitor/referrer targeting."
}Admin list calls
pagination: false does not remove the limit on these services; they fall back to 20 rows and ignore size. Call exactly:
{ "pagination": true, "page": 1, "size": 100 }Error Reference
| Status | errorCode | Where | Meaning |
|---|---|---|---|
| 404 | PLACEMENT_NOT_FOUND | Serve | Slug unknown or placement inactive. Storefront shows the fixture. |
| 503 | SYSTEM_MAINTENANCE_ACTIVE | Any | Storefront propagates it to error.tsx; not turned into a fixture. |
| 400 | validation | Tracking | Missing id or unknown field. The BFF swallows it and answers 202. |
| 429 | throttle | Serve, tracking | Tier exceeded. Serve falls back to the fixture; tracking is lost silently. |
| 403 | permission | Admin placements list | Analytics filter shows "Any" only. |
Guardrail Summary
- Never read
generatedAtorslots. The response hasservedAtanditems. - Treat
ctaUrl,bgColorand image URLs as untrusted strings. The backend does not validate them at write time. Run links throughtoSafeBannerHref, images throughtoBannerImageSrc, and accept a colour only if it matches^#[0-9a-fA-F]{3,8}$. - Never rename
home_bento_1..7. The storefront requests them by name. - Render only
banners[0]for these placements. - Never send tracking with only one of
bannerPublicIdandplacementPublicId. - Do not use
pagination: falsefor admin lists. - Do not wrap
getBannersorgetHeroBentoDatato swallow the maintenance 503.
See Also
Home Bento Dynamic Backend Architecture
Internal architecture of the home bento feature across backend seed, storefront and admin — composition, data model, invariants, and configuration.
Newsletter Module Overview
Double opt-in mailing list and admin promotional campaigns — consent, one-click unsubscribe, and a send that resumes instead of re-sending.