Replace the storefront builder draft
Replaces the working draft. The live storefront is untouched until you publish. THE WHOLE DOCUMENT REPLACES THE STORED ONE. There is no merge and no partial update: read GET /api/v1/online-store, change what you mean to change, and send the result back. expected_updated_at IS REQUIRED. This document is a singleton, so you, the merchant’s dashboard and every other integration are writers on one row, and a write naming no version would overwrite work nobody knows was lost. Send null only when you believe the store has no configuration at all; otherwise send the updated_at you last read. A mismatch is 409 config_modified, and the fix is always the same: re-read, re-apply your change, re-send.
Authorizations
A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.
Headers
A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.
Body
ALL THREE KEYS ARE REQUIRED and none is defaulted. Defaulting schema_version would store your document under a format it was not written for, and defaulting expected_updated_at would make the unsafe write the easy one. published, published_at, updated_at, store_id and published_by are refused BY NAME rather than ignored, so a client that tried to change the live storefront directly is told instead of being answered 200 while nothing happened.
The builder document format. A version this backend does not know is a 400 rather than a document stored and rendered as nothing.
The whole builder document, which REPLACES the stored draft. It is opaque to this API: no field of it is validated beyond being a JSON object within the 512 KB bound, and nothing is merged. Read GET /api/v1/online-store, edit, send it all back.
The updated_at you last read. NULL asserts that this store has no configuration at all, which is the only way a first write can name a version that does not exist; it is refused the moment a row does exist, so it cannot be used to skip the check. A mismatch is 409 config_modified.
Response
Success
