Documentation Index
Fetch the complete documentation index at: https://docs.mareaalcalina.com/llms.txt
Use this file to discover all available pages before exploring further.
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.
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
| HTTP | error.type / code | Why | What to do |
|---|---|---|---|
| 402 | plan_limit / plan_blocks_publish | Pre-paywall account | Surface error.upgrade.upgradeUrl; do not retry until upgrade. |
| 422 | invalid_request / no_products | 0 products | Use error.nextActions[0] (POST products URL), then retry. |
| 451 | tos_not_accepted / tos_required | ToS modal not completed | Surface nextActions[0].url (dashboard). Agent cannot bypass. Retry with same Idempotency-Key after user accepts. |
| 404 | not_found / storefront_not_found | Wrong id or cross-tenant | Confirm id + ownership; cannot retry blindly. |
| 429 | rate_limited / rpm_exceeded | Per-user rpm: 60 cap | Sleep Retry-After, retry with same key. |
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.