{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bigcommerce/json-schema/bigcommerce-widget-template-post-schema.json",
  "title": "widgetTemplate_Post",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bigcommerce-widget-template-api-openapi.yml#/components/schemas/widgetTemplate_Post",
  "type": "object",
  "x-internal": false,
  "properties": {
    "name": {
      "type": "string",
      "description": "User-friendly name."
    },
    "schema": {
      "$ref": "#/$defs/widgetSchema"
    },
    "template": {
      "type": "string",
      "description": "Handlebars HTML content. Also has access to Stencil Paper helpers.",
      "format": "html"
    },
    "storefront_api_query": {
      "type": "string",
      "description": "The GraphQL Storefront API query that provides widget data."
    },
    "channel_id": {
      "type": "integer",
      "description": "The id of the channel on which to create this template. Defaults to the first channel created on the store."
    }
  },
  "required": [
    "name",
    "template"
  ],
  "$defs": {
    "widgetSchema": {
      "type": "array",
      "description": "The schema for the widget’s merchant-facing UI. For more information on the available schema settings, see [Widget UI Schema](/docs/storefront/widgets/input-reference/schema). ",
      "title": "",
      "items": {
        "anyOf": [
          {
            "$ref": "#/$defs/widgetSchemaTab"
          },
          {
            "$ref": "#/$defs/widgetSchemaArray"
          },
          {
            "$ref": "#/$defs/widgetSchemaHidden"
          }
        ]
      },
      "x-internal": false
    },
    "widgetSchemaArray": {
      "type": "object",
      "title": "widgetSchemaArray",
      "description": "**Array.** Use the **array** settings type to build collections of elements within the widget. Each element in the array can contain tabs, sections, and an entire schema.",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "array"
          ]
        },
        "label": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "defaultCount": {
          "type": "integer",
          "description": "number of elements in the list to display by default."
        },
        "entryLabel": {
          "type": "string",
          "description": "name for each element in the list"
        },
        "thumbnail": {
          "type": "object",
          "description": "used to display an image stored at the specified attribute name",
          "properties": {
            "type": {
              "type": "string"
            },
            "valueKey": {
              "type": "string"
            }
          }
        },
        "schema": {
          "description": "The schema used for each element in the array.",
          "type": "array",
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/widgetSchemaHidden"
              },
              {
                "$ref": "#/$defs/widgetSchemaTab"
              }
            ]
          }
        }
      },
      "x-internal": false
    },
    "widgetSchemaHidden": {
      "type": "object",
      "title": "widgetSchemaHidden",
      "description": "**Hidden.** Use the **hidden** settings type to create controls that have no user interface drawn in Page Builder. Hidden settings are not grouped into any other tabs or arrays.",
      "x-internal": false,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "hidden"
          ]
        },
        "settings": {
          "type": "array",
          "items": {
            "type": "object",
            "title": "widgetSchemaSetting_Base",
            "description": "For examples of each type of setting, see [Page Builder > Schema Settings](/docs/storefront/widgets/input-reference/settings#alignment) in Theme Docs.",
            "properties": {
              "type": {
                "type": "string",
                "description": "The type of setting component to display. You can view the list of elements below to discover which are available to use.\n\nFor examples of each type of setting, see [Page Builder > Schema Settings](/docs/storefront/widgets/input-reference/settings#alignment) in Theme Docs.",
                "enum": [
                  "alignment",
                  "boolean",
                  "boxModel",
                  "code",
                  "color",
                  "imageManager",
                  "input",
                  "number",
                  "productId",
                  "productImage",
                  "range",
                  "regexInput",
                  "select",
                  "text",
                  "toggle"
                ]
              },
              "label": {
                "type": "string",
                "description": "The user friendly message to inform the user how this setting will be used."
              },
              "id": {
                "type": "string",
                "description": "The variable name where the setting value will be available in the widget template."
              },
              "default": {
                "type": "string",
                "description": "The default value to use when rendering the widget for the first time. Make sure to set sensible defaults to make your widget easier to use."
              },
              "typeMeta": {
                "type": "object",
                "description": "Additional information needed based on the selected setting type.",
                "properties": {
                  "selectOptions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "conditional": {
                "type": "object",
                "title": "widgetSchemaConditional",
                "description": "An optional property that can be added to each setting to control whether it should be displayed to the user while editing in Page Builder. This does not clear the value in the setting, just controls the display of the setting.",
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "The ID of the `setting` object the conditional attribute is related to."
                  },
                  "operator": {
                    "type": "string",
                    "description": "Specifies the operation used to determine whether to display the setting. The `IN` operator is currently the only supported operator. The setting will be displayed if the conditional’s `value` property is equal to the selected value of the `selectOptions`. "
                  },
                  "value": {
                    "type": "array",
                    "description": "A single-object array containing a value from the `typeMeta`'s `selectOptions`.",
                    "items": {}
                  }
                }
              }
            }
          }
        }
      }
    },
    "widgetSchemaTab": {
      "type": "object",
      "title": "widgetSchemaTab",
      "description": "**Tab.** Use the **tab** settings type to create settings visible in Page Builder.",
      "properties": {
        "type": {
          "type": "string",
          "description": "The type of setting component to display.",
          "enum": [
            "tab"
          ]
        },
        "label": {
          "type": "string",
          "description": "The user-friendly message to inform the user how this setting will be used."
        },
        "sections": {
          "type": "array",
          "description": "Groups of related settings.",
          "items": {
            "type": "object",
            "title": "widgetSchemaTabSections",
            "properties": {
              "label": {
                "type": "string",
                "description": "The user-friendly message to inform the user how this setting will be used."
              },
              "settings": {
                "type": "array",
                "description": "For examples of schema settings, see [Widget UI Input Types](/docs/storefront/widgets/input-reference/settings).",
                "items": {
                  "type": "object",
                  "title": "widgetSchemaSetting_Base",
                  "description": "For examples of each type of setting, see [Page Builder > Schema Settings](/docs/storefront/widgets/input-reference/settings#alignment) in Theme Docs.",
                  "properties": {
                    "type": {
                      "type": "string",
                      "description": "The type of setting component to display. You can view the list of elements below to discover which are available to use.\n\nFor examples of each type of setting, see [Page Builder > Schema Settings](/docs/storefront/widgets/input-reference/settings#alignment) in Theme Docs.",
                      "enum": [
                        "alignment",
                        "boolean",
                        "boxModel",
                        "code",
                        "color",
                        "imageManager",
                        "input",
                        "number",
                        "productId",
                        "productImage",
                        "range",
                        "regexInput",
                        "select",
                        "text",
                        "toggle"
                      ]
                    },
                    "label": {
                      "type": "string",
                      "description": "The user friendly message to inform the user how this setting will be used."
                    },
                    "id": {
                      "type": "string",
                      "description": "The variable name where the setting value will be available in the widget template."
                    },
                    "default": {
                      "type": "string",
                      "description": "The default value to use when rendering the widget for the first time. Make sure to set sensible defaults to make your widget easier to use."
                    },
                    "typeMeta": {
                      "type": "object",
                      "description": "Additional information needed based on the selected setting type.",
                      "properties": {
                        "selectOptions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "conditional": {
                      "type": "object",
                      "title": "widgetSchemaConditional",
                      "description": "An optional property that can be added to each setting to control whether it should be displayed to the user while editing in Page Builder. This does not clear the value in the setting, just controls the display of the setting.",
                      "properties": {
                        "key": {
                          "type": "string",
                          "description": "The ID of the `setting` object the conditional attribute is related to."
                        },
                        "operator": {
                          "type": "string",
                          "description": "Specifies the operation used to determine whether to display the setting. The `IN` operator is currently the only supported operator. The setting will be displayed if the conditional’s `value` property is equal to the selected value of the `selectOptions`. "
                        },
                        "value": {
                          "type": "array",
                          "description": "A single-object array containing a value from the `typeMeta`'s `selectOptions`.",
                          "items": {}
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "x-internal": false
    }
  }
}