Introduction
Public, unauthenticated API that the Marqii embeddable widget (packages/widget) calls to load a published widget’s data and config.
Served by packages/express-api (ECS) behind CloudFront at https://embed.marqii.com.
Endpoint
GET /api/v2/public/widget/{widgetId}?widgetType={widgetType}
The widget is read from DynamoDB (pk id, sk type). Large menus widgets are stored as gzipped partitions (menus#<menuId>); the API merges and decompresses them, sorts by position, and returns the same shape as an uncompressed widget.
Every 200 response also includes a geo object built from CloudFront viewer headers (latitude, longitude, ip, country, city). All of its fields are null when the headers are missing (for example, when the API is called directly instead of through CloudFront).
Caching
ETagis a strong ETag.Access-Control-Expose-Headers: etaglets the browser read it.Cache-Control: s-maxage=3600, stale-while-revalidate=604800, stale-if-error=604800means CloudFront caches for 1 hour and serves stale content for up to 7 days.- The widget stores the ETag and body in
localStorage(marqii::widget::eTag-<id>/marqii::widget::data-<id>) and sendsIf-None-Matchon the next load.
