Block Details

Overview

The Block Details API provides comprehensive information about the structure and properties of blocks in your storefront. This documentation outlines all available fields and their values that you can access and modify through the API.

API Access: Block Details are accessed through the Blocks API endpoints using the block_id or when creating/updating blocks.

Block Fields Reference

The following table outlines all fields available in a block object:

Field Type Description
block_id integer A unique identifier of the block.
type string The type of the block, which determines its functionality and available properties.
properties object Configuration settings specific to the block type that control its behavior and appearance.
company_id integer ID of the vendor associated with this block.
lang_code string Two-letter language code (e.g., en, es, fr) that specifies which language version of the block this is.
name string The display name of the block as it appears in the admin interface.
content object Content data specific to the block type. Available for certain block types like banners, html_block, etc.

Block Types and Properties

Different block types have unique properties and content requirements. Here are some common block types and their specific properties:

HTML Block (html_block)

{
  "block_id": 42,
  "type": "html_block",
  "properties": {
    "template": "blocks/html_block.tpl"
  },
  "company_id": 1,
  "lang_code": "en",
  "name": "Special Offer Banner",
  "content": {
    "content": "<div class=\"offer-banner\">Limited Time Offer: 20% Off All Orders</div>"
  }
}

Product List Block (products)

{
  "block_id": 43,
  "type": "products",
  "properties": {
    "template": "blocks/products/grid_list.tpl",
    "item_number": 8,
    "hide_options": false,
    "show_price": true,
    "show_rating": true
  },
  "company_id": 1,
  "lang_code": "en",
  "name": "Featured Products",
  "content": {
    "items": {
      "filling": "bestsellers",
      "limit": 8
    }
  }
}

Menu Block (menu)

Common Block Properties

While each block type has unique properties, several common properties are shared across multiple block types:

Property Type Description
template string The template file used to render the block on the storefront.
width string Width of the block. Possible values: full_width, content_width, or a specific pixel value.
wrapper string CSS class for the block wrapper for custom styling.
user_class string Additional CSS classes to apply to the block.
animation object Settings for visual animations when the block enters the viewport.
Tip: When creating or updating blocks via the API, include only the properties you need to modify. The system will maintain default values for any properties you don't specify.

Content Object Structure

The content object varies significantly based on the block type:

For HTML Blocks

For Product Blocks

For Category Blocks

Important: When updating a block, be careful not to overwrite the entire content object if you only want to modify specific fields. First retrieve the current block details, then update only the specific content properties you want to change.