Skip to content

Write a theme preview draft

PUT
/stores/{storeRef}/themes/{id}/preview-draft/{draftId}
curl --request PUT \
--url https://apibase.ecomweb.app/api/v1/stores/example/themes/example/preview-draft/example \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "settings_values": {} }'

Stores unsaved setting values for a preview draft created with a preview token. Only the preview token that names the draft shows them; the theme’s saved values do not change. Needs the write:settings scope.

Required scopes: write:settings

id
required
string

The theme ID.

draftId
required
string

The draft_id returned with the preview token.

storeRef
required
string

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

Media typeapplication/json
object
settings_values
required

The theme editor’s unsaved values, whole, by setting ID. They are laid over the saved ones when the preview opens with the matching preview token.

object

Example generated

{
"settings_values": {}
}

The draft was stored.

The request is malformed or failed validation.

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 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"
}