Modules and banners
Create and manage the content blocks in your storefront layouts, header and footer. For general appearance, mobile options and page settings, start with Store design.
Changes take effect on the live store immediately. Read the existing module first and send only the fields you want to change. Check the result in a browser on desktop and mobile.
Authentication and endpoints
Use https://api.sellavi.com with your API bearer token and the themesModules permission. Send Content-Type: application/json for JSON writes. See Authentication.
| Operation | Endpoint |
|---|---|
| List | GET /modules |
| Read | GET /modules/{layout_module_id} |
| Create | POST /modules |
| Update | PUT or PATCH /modules/{layout_module_id} |
| Delete | DELETE /modules/{layout_module_id} |
| Reorder or move | POST /modules/order_change |
| Delete a banner | DELETE /modules/{layout_module_id}/banners/{banner_image_id} |
List and read
Optional query parameters: layout_id (integer, 0 or greater), position (content_top, content_bottom, header, footer), page (1 or greater, default 1), and limit (1–100, default 10). Omit layout_id to include all layouts; use 0 for global modules. Results sort by sort_order, then layout_module_id.
Query parameters and response fields
Example: GET /modules?layout_id=0&position=header&page=1&limit=10.
List responses contain success, response (module array), results, pages, page, per_page, and request_id. An empty list is successful with response=[], results=0 and pages=0. Single reads put one module in response. Both include raw settings and banners with their description rows; banner read data is not the banner write payload.
Create and update
On creation, supply the required fields below. On update, send only the fields to change. The API loads the saved module and preserves omitted fields, nested settings and translations. The URL identifies the module; no body layout_module_id is needed. Both PUT and PATCH accept partial updates.
Request fields and example payload
Settings objects are merged by key. A supplied settings list, such as questions or related_ids, replaces that entire list. Leaving a list out keeps it. Do not send null or an empty value to mean “leave unchanged”; omit the field instead.
For example, hide a module with PATCH /modules/{layout_module_id}:
Code(json)
Its other settings and banners stay saved.
The Required column below applies to creation. On update, these values can be omitted to retain their saved values.
| Field | Required | Meaning |
|---|---|---|
| layout_id | Yes | 0 for global modules, or an existing layout ID owned by this store |
| code | Yes | Module type allowed in that layout or global position |
| component | Yes | layout for a positive layout_id; header/footer matching position for layout_id=0 |
| position | Yes | content_top/content_bottom for layouts; header/footer for global modules |
| sort_order | Yes | Integer, 0 or greater |
| settings | Yes | Object containing status and module-specific fields |
| settings.status | Yes | 0 or 1 |
| settings.name | No | Display name; use this instead of the top-level name field |
| settings.title | No | Text keyed by numeric language ID |
| settings.related_ids | No | Related page IDs for layout modules |
| banners | No | Image collection for code=banners, product_list or product_slide; see below |
Create a header message:
Code(json)
Language ID 1 is illustrative. Replace it with an accepted language ID. A layout text module uses code=short_content, component=layout, position=content_top (or content_bottom), and a positive layout_id belonging to the store.
Creation returns HTTP 200 with { "success": true, "response": { "id": 123 }, "request_id": "..." }. Update and delete return HTTP 200 with a message under response. Use the returned ID for subsequent reads, updates, or deletion.
Module types and settings
Header allows custom_content and announce. Footer also allows footer_widget. Layouts allow homefeaturedcategory, banners, category_slide, product_slide, embed, info_slider, brands, faq, custom_code, and short_content. product_list is allowed on the home layout (common/home) only. Layout availability is validated against the store's layout route.
Supported modules and settings
New modules require settings.status. Unless called optional below, the listed settings are required on creation. Localized text uses objects keyed by numeric language IDs.
| Code | Settings |
|---|---|
| short_content / custom_content | Optional text: localized string map |
| announce | announces array; each supplied text value must contain nonempty text, maximum 300 characters after HTML cleanup; optional url must be a URL |
| footer_widget | links array; each link requires type (1, 2, 3, or 4); optional selected array, href URL, numeric id, and localized text |
| custom_code | Optional html (must pass server Twig validation); optional vars array with name and localized value |
| faq | questions array; localized question values max 255 characters, answer values max 1500 |
| brands | limit (1–32); optional slider_disabled (0 or 1) |
| info_slider | limit (1–32), source (blog/information_ids); information_ids array when source=information_ids |
| homefeaturedcategory | limit (1–100), sort (c.sort_order/c.date_added/items_order), direction (asc/desc), source (category/all), show_details_btn (0/1); categories array (max 32) when source=category |
| category_slide | limit (1–55), source (all/category/categories), sort (c.sort_order/c.date_added/items_order), direction (asc/desc); category and category_name when source=category; categories array (max 32) when source=categories; optional slider_disabled |
| product_slide | limit (1–32), source (products/category), sort (p.sort_order/p.date_added/p.viewed/input_order), direction (asc/desc); products array (max 32) when source=products; category and category_name when source=category; optional slider_disabled and product banner settings below |
| product_list | limit (1–99999), source (products/category/all), sort (p.sort_order/p.date_added/p.viewed/items_order), direction (asc/desc), mobile_grid (1/2); products array (max 32) when source=products; category and category_name when source=category; optional product banner settings below |
| embed | link URL, video_attributes object, container_attributes object; container_attributes requires position (justify-content-start/justify-content-center/justify-content-end), full_width and full_height booleans; video_attributes optionally accepts numeric width/height, string src, and 0/1 allowfullscreen/autoplay |
| banners | limit (1–32), style (0/1), banner_show_title (0/1), show_details_btn (0/1), banner_content_align (left/right/center); optional integer banner_type and string transformation/transformation_mobile |
Banners between products
Both product_list and product_slide accept the same top-level banners array as the banner module. The API and MCP use the same settings and validation.
Banner settings, sizing and examples
| Setting | Meaning |
|---|---|
| settings.banners_enabled | Optional 0/1. Disabled for new modules when omitted. Set 0 to hide banners while keeping their saved images. |
| settings.banners_interval | Integer, at least 1; required when banners_enabled=1. Counts products, not banners. |
| settings.banners_desktop_columns | Optional 1/2, default 1. Applies to every banner in this module on screens 992 px and wider. Smaller screens keep one product space. |
| banners | Up to 2 saved banners per product module, including existing banners omitted from a partial update. Each new banner needs desktop and mobile CDN URLs. |
An interval of 2 inserts banner 1 after product 2 and banner 2 after product 4. Each banner appears once; the sequence continues across product-list pagination. The product limit still counts products only. Banners beyond the available products are not shown. Disabled banners, an empty saved banner collection, or modules without these options keep the existing product rendering.
By default, each banner occupies one product space in the current theme's grid or slider. Set settings.banners_desktop_columns to 2 for every banner in this module to span two product spaces on screens 992 px and wider. The same setting applies to all banners; individual banner widths cannot differ. Mobile/tablet stays one product space. If a wide banner does not fit in the remaining grid columns, it starts on the next row and following products fill the gap. Its visible position may therefore be later than the configured product interval.
For 1 space, recommend desktop/mobile 900 × 1200 px (3:4), transformed to 450 × 600 px. For 2 spaces, recommend desktop 1800 × 1200 px (3:2), transformed to 900 × 600 px; mobile/tablet stays 900 × 1200 px, transformed to 450 × 600 px. In wide mode the mobile image is selected below 992 px; in one-space mode it is selected below 768 px. Banner height follows the product row, so keep text away from edges that may be cropped.
Create a homepage product list with one banner using POST /modules:
Code(json)
Replace layout_id with this store's home layout ID and the image URLs with real uploaded CDN URLs. product_slide uses the same banner fields; supply its required product/category source settings from the table above. product_list remains limited to the home layout.
Enable or change the interval of an existing module with PATCH /modules/{layout_module_id}:
Code(json)
Omitted settings and banners remain unchanged. Existing banner fields can be edited as described below. Adding a third saved banner fails validation, even when only one new banner is supplied alongside two retained banners. Delete a banner explicitly through the API endpoint (or MCP delete_banner) before adding its replacement. Set banners_enabled=0 to hide the banners without deleting them.
Banner writes
Send images in the top-level banners array. New images require banner_image_id=0, image (desktop URL), and image_mob (mobile URL). An existing banner can be edited with just its banner_image_id and changed fields. Both URLs must match the configured CDN. Optional fields are link and title (a language-ID-to-text map).
Image fields and update example
Use banner_image_id=0 for new images. Positive IDs must already belong to the authenticated store and the module in the URL. A new module therefore uses 0 for every image. Read responses contain description rows; convert them to the title map when writing.
Omitted banners are retained. Omitting banners or sending banners: [] does not delete any images. A partial banner update preserves the current image order and appends new images. To reorder all images, include every existing banner ID in the intended order.
Change just one banner link with PATCH /modules/{layout_module_id}:
Code(json)
Replace 45 with an ID from the module read response. Existing desktop/mobile images and translations stay saved. A banner ID must belong to this module and cannot appear twice.
To remove one image, use DELETE /modules/{layout_module_id}/banners/{banner_image_id}. Deleting a banners, product_list or product_slide module removes its related banner images. These deletions affect the live store and cannot be undone through CSS/JS snapshots.
Languages and banner effects
Use numeric language IDs accepted by your store. Read the language list before sending localized text; do not copy example IDs unchanged.
Language IDs and effects
Banners accept optional settings.banner_effect_type (fade or slide).
Reorder and move modules
Use POST /modules/order_change to arrange modules in a layout or in the global header/footer. Read the layout's allowed module codes and positions first.
Ordering payload and move behavior
Code(json)
The IDs above are examples. Use IDs from your store. Listed modules are placed first in that order; unlisted modules in each supplied position follow in their existing relative order. Positions left out are unchanged.
For a move from another layout, also supply layout_module_id and include that ID in sorted_modules. Use layout_id: 0 and header/footer positions for global modules. A module may appear only once and must be allowed in its destination. Moving between layouts clears its old settings.related_ids; review any page-specific targeting afterwards.
MCP tools
Use list_modules and get_module to read before editing. Use create_module, update_module, reorder_modules, delete_module and delete_banner for changes. Module IDs use the argument layoutModuleId; delete_banner also needs bannerImageId. Create, update and reorder calls take a payload object containing the matching API body.
Tool names, permissions and arguments
For product lists and sliders, pass settings.banners_enabled, settings.banners_interval, settings.banners_desktop_columns and the top-level banners array inside the payload of create_module or update_module. The two-banner limit includes retained images. Use get_module or list_modules to obtain inline banner IDs; inspect_brand_assets reads the separate branding banner module. update_banner can replace an existing inline banner's desktop/mobile image and imports public image URLs with the banner tag. New inline banners use uploaded CDN URLs in create_module/update_module.
Deletion tools require confirmed: true after approval of the exact item. Read-only tools require modules:read; creation requires modules:create, edits and ordering require modules:update, and deletion requires modules:delete. The Store design guide covers the other design tools.
Errors and scope
Status codes and limitations
- 400: duplicate banner/module IDs or an invalid ordering request.
- 401: missing, invalid, or expired authentication.
- 403: missing API permission or MCP scope, or a layout not accessible to the store.
- 404: the requested module does not exist in this store.
- 422: invalid payload or failed creation. Validation responses include message and errors; creation failures include success=false and message.
For shared header/footer settings and per-layout settings, see Store design. There is no draft/publish step or automatic version-conflict check.