Nano Store - Ecommerce Docs
Developer ResourcesHome Bento Dynamic

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

SurfacePrefixAuth
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/placementsJWT + Placements_READ / _CREATE / _UPDATE
Admin banners/api/admin/bannersJWT + banners read permission
Admin analytics/api/admin/banner-analytics/stats, /eventsJWT + BANNER_ANALYTICS_READ

Endpoint Reference

MethodPathAuthDescription
GET/api/mobile/banners/serve/:slugPublicBanners for one placement. The bento calls it once per slug, seven times per render.
POST/api/mobile/banners/events/impressionPublicRecord an impression. 202.
POST/api/mobile/banners/events/clickPublicRecord a click. 202.
POST/api/store/banners/events/impressionSame-originStorefront BFF; forwards to the backend, always answers 202.
POST/api/store/banners/events/clickSame-originStorefront BFF; same behavior.
GET/api/admin/placementsPlacements_READList placements. Query page, size (max 100).
POST/api/admin/placementsPlacements_CREATECreate a placement.
PATCH/api/admin/placements/:publicIdPlacements_UPDATEUpdate a placement. Still accepts slug; the admin edit dialog does not send it.
PATCH/api/admin/placements/:publicId/deactivatePlacements_UPDATEDeactivate a placement. Used to retire home_hero, home_promo_left, home_promo_right.
GET/api/admin/bannersbanners readList banners. Same list query.
GET/api/admin/banner-analytics/statsBANNER_ANALYTICS_READDaily rollup (UTC).
GET/api/admin/banner-analytics/eventsBANNER_ANALYTICS_READRaw 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 no generatedAt, and the slot list is items, not slots.
  • The example is illustrative. Field names and types come from BannerServeResponseDto and BannerServeItemDto; the placement id, image key, and timestamp values are sample data. The primaryImageUrl is shown as a storage key because the backend stores a key; the storefront resolves it against the asset origin.
  • ctaUrl arrives already resolved (override, then target URL, then stored). Do not rebuild a URL from target.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

StatuserrorCodeWhereMeaning
404PLACEMENT_NOT_FOUNDServeSlug unknown or placement inactive. Storefront shows the fixture.
503SYSTEM_MAINTENANCE_ACTIVEAnyStorefront propagates it to error.tsx; not turned into a fixture.
400validationTrackingMissing id or unknown field. The BFF swallows it and answers 202.
429throttleServe, trackingTier exceeded. Serve falls back to the fixture; tracking is lost silently.
403permissionAdmin placements listAnalytics filter shows "Any" only.

Guardrail Summary

  • Never read generatedAt or slots. The response has servedAt and items.
  • Treat ctaUrl, bgColor and image URLs as untrusted strings. The backend does not validate them at write time. Run links through toSafeBannerHref, images through toBannerImageSrc, 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 bannerPublicId and placementPublicId.
  • Do not use pagination: false for admin lists.
  • Do not wrap getBanners or getHeroBentoData to swallow the maintenance 503.

See Also