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:- The storefront must have at least one product (else 422
no_products). - 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.
- The user must have accepted the dashboard ToS modal (else 451). The agent cannot bypass this.
GET /v1/me if you want to surface a CTA before the publish round-trip:
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.
{ "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
_links.publicUrl to the user: that’s the share-and-print-and-QR-code URL. If the owner later changes the link in the dashboard, this URL keeps working and redirects to the new one.
The four error gates
Every error follows the §9.6 envelope verbatim. Branch onerror.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 sameversionId 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
- Publishing concept — full gate semantics + idempotency rules.
- ToS jurisdiction — what the 451 ToS modal contains.
- Plan limits — per-plan storefront caps + the publish-block-on-pre-paywall rule.