Skip to main content

Update Home Page Blocks

PUT 

/api/admin/portal/home/blocks

Replace the Home page blocks only. Announcements, featured products and the landing page are left as they are, so this can be saved on its own without sending the rest of the configuration.

Required scope: customers:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Body fields:

  • blocks (required, array, at most 20 blocks, built-ins included; may be empty): the Home page layout, in display order. The stored blocks are all replaced; an empty array resets Home to the five built-in sections, all visible.
  • blocks_version (optional, string up to 64 characters, or null): the blocks_version this edit started from, from Get Portal Home Page or the previous save. If the saved blocks have changed since, nothing is saved and the response is 409. Leave it out, or send null, to save without the check.

Each block:

  • type (required): a built-in section, announcements, account_summary, spend_progress, featured or order_again, or a custom block, banner_carousel, link_tiles, category_tiles, brand_tiles or product_grid. Each built-in may appear at most once; a built-in left out is added back, visible, at the end. Custom blocks may repeat.
  • id (optional, string up to 40 characters, or null): a custom block's id from a previous response, to keep it. Null, or an id the last save did not have, creates a new block with a new ULID. Built-ins ignore it: their id is always their type.
  • visible (optional, boolean, default true): false hides the block from every buyer. A built-in only uses type and visible.
  • heading (optional, string up to 60 characters, or null): the title shown over a custom block.
  • audience (optional, object or null): catalog_ids null (or no audience) = every dealer; a list of portal catalog ids = only dealers on at least one of those catalogs; an empty list = no dealer. Each id is a positive integer; a save also needs it to be an existing, not deleted, portal catalog ("One of the chosen catalogs no longer exists. Remove it and save again.").
  • settings (optional, object or null):
    • auto_advance (optional, boolean, default false) and interval (optional, seconds between slides: 5, 7 or 10; default 7): banner carousels only.
    • columns (optional, integer): 2, 3 or 4 for link tiles; 3, 4 or 6 for category tiles and product grids (default 4); 4, 6 or 8 for brand tiles (default 6).
    • link_to (optional, catalog or assets, default catalog): brand tiles only. catalog opens the catalog filtered to the brand; assets opens the brand's assets link in a new tab (a brand without one opens its catalog page).
    • count (optional, 4, 8, 12, 16 or 24, default 8): product grids only. How many products show at first, and how many each "Load more" adds.
    • sort (optional, name, price_asc, price_desc or newest, default name): product grids only. Prices sort by each dealer's own price.
  • slides (banner_carousel, required: 1 to 8). Each slide:
    • id (optional, string up to 40 characters, or null): the slide's id from a previous response, to keep it; otherwise a new ULID is given.
    • image (required, object): the desktop artwork, {path, width, height} as returned by Upload Home Page Image with kind = slide. path (required, up to 255 characters) is the uploaded file: under portal/home/ and ending in .jpg, .jpeg, .png, .webp, .svg or .gif. A save also needs the file to still exist ("This image is missing. Upload it again."), and applies the same check to mobile_image and tile images; width and height are optional integers of at least 1.
    • mobile_image (optional, same object, or null): artwork for phones, uploaded with kind = slide_mobile.
    • alt (required, string up to 160 characters): describes the slide for people who cannot see it.
    • link (optional, link object or null): where the slide goes when clicked.
    • starts_at / ends_at (optional, ISO-8601 date-time or null): when the slide is shown. ends_at must be after starts_at; null start = now, null end = never ends. A value without an offset is read as UTC; dates are stored in UTC.
  • tiles (link_tiles, required: 2 to 8). Each tile:
    • id (optional, string up to 40 characters, or null): as for slides.
    • label (required, string up to 40 characters): must be unique within the block, ignoring case.
    • caption (optional, string up to 80 characters, or null).
    • icon (string, or null): one of the curated icon names: mdi-star-outline, mdi-lightning-bolt-outline, mdi-cart-outline, mdi-clipboard-list-outline, mdi-file-document-edit-outline, mdi-receipt-text-outline, mdi-cash-multiple, mdi-credit-card-outline, mdi-truck-outline, mdi-truck-fast-outline, mdi-package-variant-closed, mdi-keyboard-return, mdi-shield-check-outline, mdi-tag-outline, mdi-sale-outline, mdi-percent-outline, mdi-heart-outline, mdi-fire, mdi-new-box, mdi-gift-outline, mdi-trophy-outline, mdi-file-download-outline, mdi-book-open-variant, mdi-school-outline, mdi-video-outline, mdi-image-outline, mdi-palette-outline, mdi-storefront-outline, mdi-map-marker-outline, mdi-calendar-star, mdi-clock-outline, mdi-headset, mdi-phone-outline, mdi-email-outline, mdi-help-circle-outline, mdi-information-outline, mdi-cog-outline, mdi-tools, mdi-wrench-outline, mdi-bike. Any other name is refused with "Pick one of the listed icons."
    • image (object, or null): {path, width, height} uploaded with kind = tile. A tile needs exactly one of icon and image.
    • link (required, link object).
  • categories (category_tiles, required: 1 to 12). Each entry:
    • id (required, positive integer): a product category, at most once per block (the same category may appear in different blocks). A save also needs the category to exist and not be archived ("This category is archived or no longer exists. Remove it and save again.").
    • label (optional, string up to 40 characters, or null): shown instead of the category name.
    • image (optional, object or null): the tile's own picture, {path, width, height} uploaded with kind = tile. Without one the tile shows the category's own image.
  • brands (brand_tiles, required: 1 to 24). Each entry:
    • id (required, positive integer): a product brand, at most once per block. A save also needs the brand to exist ("This brand no longer exists. Remove it and save again.").
    • label (optional, string up to 40 characters, or null): shown instead of the brand's portal name (and used as the tile's accessible name). The tile shows the brand's logo, or its name when it has none.
  • source (product_grid, required, object): where the grid's products come from.
    • type (required): category, brand or collection.
    • id (required, positive integer): the category, brand or tag id. A save needs the category to exist and not be archived, the brand to exist, and the tag to be published as a collection ("This tag is not a published collection. Publish it under Catalog display, or choose another."). Items that do not belong to a block's type (for example tiles on a banner) are not stored.

A link is an object:

  • type (required): catalog (the whole catalog), category, brand, tag, page (an info page), portal (a portal page) or url (a web address).
  • id: the category or brand id; a positive integer, required for category and brand. Optional for tag, so a renamed tag is still followed.
  • value: for tag the tag name (up to 100 characters); for page the info page slug (lower-case letters, numbers and dashes, for example returns-policy); for portal one of home, catalog, brands, quick-order, special-order-list, lists, quotes, orders, invoices, returns or my-company; for url an address starting with https://, http://, mailto: or tel: (up to 2,048 characters). Ignored for other types.
  • new_tab (optional, boolean, default false): opens a url link in a new browser tab. Ignored for other types. Only the keys a type uses are stored.

Image files that the previous blocks used and the new ones do not are deleted after the save. Uploaded images that were never saved onto a block are deleted by a later save once they are more than 24 hours old.

An invalid body returns 422 with one message per field under errors, keyed by its position (for example blocks.3.tiles.1.label). An image whose file is deleted, for example by another save, after the body was checked also returns 422 on its field ("This image is missing. Upload it again.").

A stale blocks_version returns 409 with message: "Someone else saved the home page since you opened it. Reload to see their changes." Load the blocks again before saving.

Returns blocks, blocks_version (the version just saved; send it with the next save) and limits in the same shape as Get Portal Home Page: new blocks, slides and tiles carry their new ULIDs.

Requires a staff bearer token with portal management permission.

Request​

Responses​

OK

Response Headers
    Content-Type