Skip to content
shopdepot.dev

Themes

Theme API

The HTTP API behind the CLI: read and write theme files, preview, publish and check a theme with a developer token.

View as Markdown

The theme API is what the ShopDepot CLI uses. Use it directly when you build your own tooling: an editor plugin, a deploy script, a build step that uploads compiled assets.

https://hooks.shopdepot.pl/theme-api/v1

Every request and every response is JSON unless noted otherwise. The API works on the themes of one store - the store the token belongs to.

Authentication

Create a developer token in the store admin: Sales channels → Stores → your store → Appearance → Themes → Developer access. Send it in the Authorization header:

curl https://hooks.shopdepot.pl/theme-api/v1/store \
  -H "Authorization: Bearer sdt_..."

The token is shown once and stored only as a hash. It reads and writes themes of its store and nothing else. Revoking it in the admin takes effect on the next request. A missing, mistyped or revoked token answers 401.

Errors

Errors are JSON with a message for a human and, for file operations, the path:

{ "error": "Unexpected \"}\" (line 12)", "path": "sections/content/hero.twig" }
Status Meaning
401 No token, or the token is invalid or revoked.
403 The theme cannot be changed or published: a paid theme on trial, or a licence that does not allow it.
404 No such theme in this store, or no such file.
422 The request was refused by a platform rule. The file or theme did not change.

Store

GET /store

The store of the token and its themes. Use it to check a token.

{
  "store": { "name": "Example", "handle": "example", "url": "https://example.myshopdepot.pl/", "locale": "pl", "currency": "PLN" },
  "token": { "name": "Laptop" },
  "themes": [ { "id": "0193d7a2-...", "name": "Example", "role": "unpublished" } ]
}

Themes

GET /themes

{ "themes": [ THEME, ... ] }

A theme object:

Key Description
id Theme id - use it in every theme address.
name Name in the library.
role published for the live theme, unpublished or development for the others.
package { "handle", "version" } of the registry package it was installed from, or null.
license Licence state of a paid theme in this store: not_required (free theme), trial, active (bought), expired (live, no more updates) or development (development store).
editable Whether files can be written. false for a paid theme on trial.
publishable Whether the theme can be published.
managed_by The tool that keeps the theme's code outside the store (for example studio), or null. See PATCH /themes/{id}.
available_update A newer published version of package, or null. For a theme with managed_by it is only information: the store never applies it.
updated_at Last change, ISO 8601.
preview_url A link that shows this theme on the store's data without publishing it.

GET /themes/{id}

The theme and its files, sorted by path:

{
  "theme": THEME,
  "files": [
    { "path": "assets/css/base.css", "checksum": "9f2c...", "size": 18213, "binary": false, "updated_at": "2026-11-15T14:02:11+01:00" }
  ]
}

checksum is the SHA-256 of the file's bytes. Compare it with the SHA-256 of your local file to know what changed - that is how shopdepot theme push uploads only differences.

POST /themes

Creates a theme in the store's library, always as a draft. Two forms:

Upload a ZIP (multipart/form-data, field archive, at most 50 MB):

curl https://hooks.shopdepot.pl/theme-api/v1/themes \
  -H "Authorization: Bearer sdt_..." \
  -F [email protected]

The archive becomes a private package of the store's account (only this account can install it) and is installed. theme.json must be at the top of the archive or inside one top-level folder, and its version must be new - versions are never overwritten. The response lists files the platform left out because they break the file contract:

{ "theme": THEME, "skipped": ["assets/Fonts/Mono.woff2"] }

Copy a theme of this store:

{ "duplicate": "0193d7a2-...", "name": "Example - experiment" }

Both answer 201. Add managed_by (a JSON key, or a form field next to archive) to create the theme as managed outside the store from the start.

PATCH /themes/{id}

Says who keeps the theme's code:

{ "managed_by": "studio" }

Use it when the theme's code lives in a repository and is sent with this API. Package files then never land on the theme by themselves: the nightly update skips it, the library shows no Update button and the theme cannot be reset to the package version. A newer package version still shows in available_update, so your tool can propose the update as a change in the repository. managed_by is lowercase letters, digits and -, at most 40 characters. { "managed_by": null } hands the theme back to the store - the merchant can also do it with Detach from Studio in the library. Answers 200 with { "theme": THEME }.

POST /themes/{id}/publish

Makes the theme live. 403 when the licence does not allow it.

GET /themes/{id}/preview?path=/products/example/

{ "url": "https://example.myshopdepot.pl/products/example/?preview_theme=..." }

Opening the link shows the theme to that browser for a day. ?preview_theme=off ends the preview.

Files

Paths are theme paths as in the file structure, for example sections/content/hero.twig, without a leading slash.

GET /themes/{id}/files/{path}

The file itself: text as text/plain; charset=UTF-8, images and fonts as bytes. The X-Checksum header carries the SHA-256.

PUT /themes/{id}/files/{path}

The request body is the new content: UTF-8 text, or bytes for an image or font in assets/. Creates the file or replaces it.

curl -X PUT https://hooks.shopdepot.pl/theme-api/v1/themes/0193d7a2-.../files/sections/content/hero.twig \
  -H "Authorization: Bearer sdt_..." \
  --data-binary @sections/content/hero.twig
{ "path": "sections/content/hero.twig", "checksum": "9f2c...", "size": 1264 }

A write goes through the same rules as the code editor in the admin, and a refused file is not saved:

  • the file contract - path, kind, size,
  • JSON syntax, and the {% schema %} of sections and blocks,
  • Twig syntax and the sandbox: tags, filters, functions and methods a theme may use.

Every write keeps the previous version of the file with CLI: <token name> as the author, so the code editor in the admin can restore it.

Writing config/settings_data.json also applies its current object to the theme's settings in the store - colours, fonts, widths, everything the theme editor sets. Those values live on the theme, not in the file, so this is how a file you send on purpose shows up on the storefront. Keys missing from your file keep their values. The response then has settings_applied, the list of settings that changed.

DELETE /themes/{id}/files/{path}

{ "deleted": "snippets/old-card.twig" }

theme.json and layout/theme.twig cannot be deleted (422).

Check

POST /check

Runs a whole theme through the save rules without touching any theme in the store, plus checks for common mistakes (missing content_for_header, missing brand tokens, sections without section.attributes). This is shopdepot theme check.

{
  "files": { "theme.json": "{ ... }", "layout/theme.twig": "<!doctype html> ..." },
  "binaries": { "assets/fonts/body.woff2": 48211 }
}

files holds text files with their content; binaries holds paths and sizes of images and fonts (their content is not needed).

{
  "errors": 1,
  "warnings": 1,
  "problems": [
    { "path": "sections/content/hero.twig", "level": "error", "message": "Unexpected \"}\" (line 12)" },
    { "path": "sections/content/hero.twig", "level": "warning", "message": "the root element does not print {{ section.attributes }} - the theme editor cannot select the section." }
  ]
}

Building a theme from the store's data

These calls help a tool (ShopDepot Studio, your own scripts) map an existing site onto sections and fill them with the store's real data.

GET /themes/{id}/sections

Every section and block that can be placed in this theme: the platform's core sections plus the theme's own files. Each entry has key (sections/faq), kind (sections or blocks), type, name, source (core or theme), doc, settings (id:type), blocks, presets and targets. A theme file with the same name as a core section replaces it and has overrides_core: true.

GET /sample

A small sample of the store's data to wire sections to: categories (handle, name, depth, url and what the merchant set for the category - see below), menus (handle, name) and published offers (handle, title, url), plus category_count and offer_count. No customers, orders or purchase prices.

Each category also says what it has, so you can pick one to check a banner, an icon or the text below the products:

{ "handle": "serums", "name": "Serums", "depth": 1, "url": "https://example.myshopdepot.pl/categories/serums/",
  "heading": "Face serums", "image": "https://cdn.example/m/…/serums_480.webp", "icon": null, "icon_vector": false,
  "has_description": true, "has_additional_description": false }

heading is the H1 set in the admin (null when the page uses the name), image a 480 px thumbnail of the category image, icon the icon (icon_vector for an SVG), has_description and has_additional_description whether there is text. In templates the same data is category.

POST /media

Uploads a file to the store's file library - a multipart request with the file in a field named file. Use it for videos, large photos and banners: a theme's assets/ folder accepts only images and fonts up to 2 MB. The same rules apply as for uploads in the admin (file types, size limits, SVG cleaned or refused, the same file uploaded twice is stored once). Answers 201:

{ "media": { "id": "…", "kind": "video", "mime": "video/mp4", "name": "hero.mp4", "url": "https://cdn.…/hero.mp4" } }

Point a video or image_picker setting of a section at the file with its id.

Reference theme

GET /starter.zip

The latest published version of base, the reference theme, as a ZIP. The X-Theme-Version header carries its version. shopdepot theme init starts from it.