Skip to content
BolderBolder Developers
Esc
↑↓navigate↵open⌘Jpreview

Write a theme file by path

Creates or replaces a file at path (e.g. layouts/default.liquid, public/css/theme.css, public/images/home/welcome.png). Send text as body, or any file as Base64 data.

The API decides how the file is stored, so clients never pick:

  • Outside public/: always a template (ThemeTemplate response).
  • public/ CSS/JS up to 65,535 bytes (UTF-8, not *.min.css/*.min.js): an editable template.
  • Anything else under public/ (images, fonts, vendor builds, bigger CSS/JS): an uploaded file (ThemeAsset response, with path).
  • A template that grows past the limit becomes an uploaded file at the same path. An uploaded file only becomes a template through POST /themes/{theme_id}/files/editable.

A path is either a template or an uploaded file, never both. Files under public/ are served at /themes/{theme_id}/public/<path after public/> on the assets host.

PUT/themes/{theme_id}/files/{path}
Authorization
AuthorizationBearer token (JWT) · headerrequired
Path parameters
theme_idstringrequired
pathstringrequired

File path in the theme, slashes included (not URL-encoded)

Request body
requiredapplication/json
bodystring

File content as UTF-8 text

datastring

File content, Base64 encoded (a data: URI prefix is accepted)

Responses
200

File replaced (it may have moved from template to uploaded file)

One of:
ThemeTemplate
_linksHalLinks
idstring
file_namestring
pathstring
bodystring

Full template source code

is_sectionboolean
schemaobject

Present only when is_section is true — the section's configurable schema.

parent_commitstring | null
updated_onstring<date-time>
warningsobject[]

Problems of the template the storefront would only show when the page renders, for an editor to show right after saving. They never block saving. Present when a single template is returned (not in the templates listed with a theme). Checked: Liquid syntax (with the storefront's own tags), a layout without {% bolder_header %} / {% bolder_footer %}, literal asset_url files the theme does not have, and literal include / include_partial templates it does not have.

Show properties
Array of object
severitystring
Allowed:errorwarning
codestring
Allowed:syntaxlayout_headerlayout_footermissing_assetmissing_include
messagestring
lineinteger

Line of the template, when known.

ThemeAsset
_linksHalLinks
idstring
file_namestring
pathstring

Path in the theme, including its public/ folder for v2 files (just file_name for legacy flat assets)

content_typestring
file_sizeinteger
digeststring
urlstring

CDN URL for this asset

updated_onstring<date-time>
201

File created

One of:
ThemeTemplate
_linksHalLinks
idstring
file_namestring
pathstring
bodystring

Full template source code

is_sectionboolean
schemaobject

Present only when is_section is true — the section's configurable schema.

parent_commitstring | null
updated_onstring<date-time>
warningsobject[]

Problems of the template the storefront would only show when the page renders, for an editor to show right after saving. They never block saving. Present when a single template is returned (not in the templates listed with a theme). Checked: Liquid syntax (with the storefront's own tags), a layout without {% bolder_header %} / {% bolder_footer %}, literal asset_url files the theme does not have, and literal include / include_partial templates it does not have.

Show properties
Array of object
severitystring
Allowed:errorwarning
codestring
Allowed:syntaxlayout_headerlayout_footermissing_assetmissing_include
messagestring
lineinteger

Line of the template, when known.

ThemeAsset
_linksHalLinks
idstring
file_namestring
pathstring

Path in the theme, including its public/ folder for v2 files (just file_name for legacy flat assets)

content_typestring
file_sizeinteger
digeststring
urlstring

CDN URL for this asset

updated_onstring<date-time>
401

Unauthorized

403

Access denied

422

Validation error (both or neither of body/data, invalid Base64, invalid path or file type, unknown field)

Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X PUT 'https://api.onbolder.com/v2/themes/abc123/files/public%2Fcss%2Ftheme.css' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "body": "body { margin: 0 }",
  "data": "string"
}'
Response
{
  "_links": {
    "property1": {
      "href": "string",
      "templated": true,
      "method": "get",
      "title": "string",
      "type": "string"
    },
    "property2": {
      "href": "string",
      "templated": true,
      "method": "get",
      "title": "string",
      "type": "string"
    }
  },
  "id": "string",
  "file_name": "layout.html",
  "path": "string",
  "body": "string",
  "is_section": true,
  "schema": {},
  "parent_commit": "string",
  "updated_on": "2019-08-24T14:15:22Z",
  "warnings": [
    {
      "severity": "error",
      "code": "syntax",
      "message": "string",
      "line": 0
    }
  ]
}

Was this page helpful?