Skip to content

Start a theme preview

POST
/stores/{storeRef}/themes/{themeId}/preview
curl --request POST \
--url https://apibase.ecomweb.app/api/v1/stores/example/themes/example/preview \
--header 'x-api-key: <x-api-key>'

Runs the build the theme uses at the theme’s own preview address for 24 hours and returns the address with its state; read the theme’s preview field to follow its state. Returns a 409 THEME_IS_LIVE for the live theme, which previews on the store itself, and a 409 THEME_NOT_DEPLOYED when the theme does not use a build. Needs a plan that includes Hosting.

Required scopes: deploy:storefront

themeId
required
string

The theme ID.

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
state
required

off: not asked for in the last 24 hours. starting: asked for, not up yet. running: up.

string
Allowed values: off starting running
until
required

When the preview stops, as an ISO 8601 timestamp, or null when it is not running.

string format: date-time
nullable
url
required

The preview’s address.

string

Example

{
"state": "off"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The resource does not exist in this store.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The request conflicts with the resource’s current state.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}