Skip to main content

Publish a storefront

Publish is the one operation that takes a storefront from draft to public — the URL becomes shareable, indexable, and live for end customers. Required scope: storefront:publish. Always require explicit user confirmation before calling — publish is user-visible.

Pre-flight checklist

Before calling publish:
  1. The storefront must have at least one product (else 422 no_products).
  2. The user must be on any active plan — Free, Basic, Pro, Business, or Agency. Pre-paywall accounts (just-signed-up, no plan picked) get 402.
  3. The user must have accepted the dashboard ToS modal (else 451). The agent cannot bypass this.
Short-circuit with GET /v1/me if you want to surface a CTA before the publish round-trip:
If plan.limits.publishable is false or tosAcceptedAt is null, surface the appropriate next-action to the user before attempting publish.

Request

POST /v1/storefronts/{storefrontId}/publish — body is optional.
Send { "versionId": "ver_xxx" } to publish a specific version snapshot; omit for auto-version (the common case — Marea creates a fresh snapshot from the current draft).

200 OK — success

Surface _links.publicUrl to the user — that’s the share-and-print-and-QR-code URL.

The four error gates

Every error follows the §9.6 envelope verbatim. Branch on error.type + error.code; surface nextActions[] to the user without paraphrasing.

402 — plan paywall (plan_blocks_publish)

The user is pre-paywall (no plan picked yet). Surface error.upgrade.upgradeUrl as a CTA; do not retry until the user upgrades.

422 — empty storefront (no_products)

The storefront has 0 products. Use nextActions[0].url to add a product before retrying.

451 — ToS not accepted (tos_required)

The user hasn’t accepted the dashboard ToS modal. The agent cannot bypass — the user must complete the modal in their browser. Retry with the same Idempotency-Key after the user accepts.

404 — not found (storefront_not_found)

Wrong storefrontId, or this user-key doesn’t own it. Cross-tenant returns 404 (leak-less), not 403 — you cannot infer existence.

Summary table

Idempotent republishing

Calling publish on an already-published storefront with the same versionId is a no-op that returns 200 with the same DTO. To republish a new version, omit versionId (auto-version) — Marea creates a fresh snapshot, runs the publish, and the live URL points at the new content. You can keep the same Idempotency-Key across retries of the same publish attempt; generate a fresh key for a new republish.

Cross-references