--- title: Banners description: Create a banner from HTML, a key-value object or both, show it through a campaign rule, and read it back from search and collection responses. slug: merchandising/business-rules/banners docKind: guide hub: luigisbox-ai --- A banner is promotional content your organization owns: a hero above the results, a strip in the filter column, a tile among the products. A banner selects no products and moves none. A campaign rule with a `banner` effect decides on which requests it shows, and the search or collection response carries it beside the hits. A banner holds its content in one of two forms, or both: - **`html`**: markup, served as written from a URL we host. - **`metadata`**: a flat key-value object for your own code, such as the headline, image and link your front end builds the banner from. The images an `html` banner shows are uploaded with it and named in the markup. ## Banner content | Field | Notes | |---|---| | `organization_id` | The organization the banner belongs to. Set on create, never changed. | | `name` | 1–256 characters, unique among the organization's banners that are not archived | | `html` | Markup, at most 64 KB in UTF-8. Banner responses return it as written, `lbx-image:` names included. See [HTML](#html). | | `metadata` | 1–20 keys of 1–64 characters from `A-Z a-z 0-9 _ . : -`. Each value is a string of at most 2,048 characters, a number (an integer must lie between −9,007,199,254,740,991 and 9,007,199,254,740,991) or a boolean. At most 64 KB in total as compact JSON in UTF-8. | A banner needs `html`, `metadata` or both. A string in `metadata` may not contain a control character, an invisible mark or a bidirectional override, and may not be a `javascript:`, `vbscript:` or `data:` URL. Every string value is checked, whatever its key. A value counts as one of those URLs when, ignoring leading spaces and letter case, it starts with that word and a colon, so `Data: 50% off` is refused too. ## Creating a banner Banners live on the platform API, next to [campaigns](/merchandising/business-rules/authoring-api/): ```text POST /platform/v1/banners GET /platform/v1/banners GET /platform/v1/banners/{banner_id} PATCH /platform/v1/banners/{banner_id} DELETE /platform/v1/banners/{banner_id} ``` A banner without images is a JSON body: ```bash curl -X POST 'https://api.eu1.luigisbox.ai/platform/v1/banners' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{ "organization_id": "lbo_r2vn8c", "name": "Northwear autumn strip", "html": "

Northwear autumn: 30 % off

Shop now
", "metadata": { "headline": "Northwear autumn: 30 % off", "target_url": "https://example.com/northwear", "discount_pct": 30 } }' ``` The response is `201` with the banner and its `lbbn_…` ID: ```json { "id": "lbbn_7h3k9w", "organization_id": "lbo_r2vn8c", "name": "Northwear autumn strip", "status": "active", "version": 1, "html": "

Northwear autumn: 30 % off

Shop now
", "html_url": "https://lbo-r2vn8c.eu1.luigisboxusercontent.com/banners/lbbn_7h3k9w/6f9d71fd2279e42d….html", "metadata": { "headline": "Northwear autumn: 30 % off", "target_url": "https://example.com/northwear", "discount_pct": 30 }, "images": [], "created_at": "2026-11-03T09:12:44Z", "created_by": null, "updated_at": "2026-11-03T09:12:44Z", "updated_by": null } ``` The response returns `html` as written, `lbx-image:` names included. `html_url` is where it is hosted, with each image placeholder replaced by the image's URL: the same URL search and collection responses return. Each change to the hosted page gives a new URL; the previous one keeps working until the banner is archived. It is `null` for a banner without `html` and for an archived banner. `created_by` and `updated_by` name the person who made the write, and are `null` for a write made with a server-to-server token. `version` changes on every change to the banner. Create, get, update and archive responses send it as the `ETag`, and an update or archive sends it back in `If-Match`; see [Editing a banner](#editing-a-banner). `GET /platform/v1/banners` lists banners ordered by ID, filtered by `organization_id` and `status`. A get by ID returns archived banners too. ### Images A banner with images is a `multipart/form-data` request. Its `banner` part holds the same JSON body, and each `images` part is one image file: ```json { "organization_id": "lbo_r2vn8c", "name": "Northwear autumn hero", "html": "\"Northwear" } ``` ```bash curl -X POST 'https://api.eu1.luigisbox.ai/platform/v1/banners' \ -H 'Authorization: Bearer ' \ -F 'banner=`, for example in an `` element's `src`. The banner's `images` list carries each image, ordered by name: ```json { "id": "8d2f4c1e-5b7a-4e3f-9c6d-2a1b0e9f7c3d", "name": "hero.jpg", "url": "https://…", "content_type": "image/jpeg", "size_bytes": 184320, "width": 1200, "height": 300, "created_at": "2026-11-03T09:12:44Z" } ``` `id` is the image's UUID, kept when an upload replaces it. An image with different content is served at a different URL. | Limit | Value | |---|---| | Formats | JPEG, PNG, GIF, WebP, read from the file's content rather than its name | | Size | 1 MB per image | | Dimensions | 4096 × 4096 pixels | | Name | 1–64 characters from `A-Z a-z 0-9 _ . -` | | Images per banner | 10 | | Situation | Result | |---|---| | A name outside the allowed characters | `422`, type `banner_image_name_invalid` | | Two images with one name in a request | `422`, type `banner_image_name_duplicate` | | An image over 1 MB | `422`, type `banner_image_too_large` | | Not a readable JPEG, PNG, GIF or WebP file | `422`, type `banner_image_format_unsupported` | | Wider or higher than 4096 pixels | `422`, type `banner_image_dimensions_too_large` | | More than 10 images on the banner | `422`, type `banner_image_limit_exceeded` | | `html` names an image the banner does not have | `422`, type `banner_image_not_found` | | An image the `html` does not name | `422`, type `banner_image_unused` | Each type is under `exception_details.validation_errors`. The body is checked first; once it passes, the problems with every file are reported together, and the image count and the names `html` uses are checked once those pass. A form that cannot be read as a banner write, such as one with two `banner` parts or more than 11 files, is a `422` of type `banner_form_invalid`. A multipart request larger than 11 MB is a `413`, and so is a JSON request larger than 144 KB. ### Editing a banner `PATCH /platform/v1/banners/{banner_id}` changes only the fields it carries, as JSON or as the same multipart form. It sends the `version` it is based on in `If-Match`: ```bash curl -X PATCH 'https://api.eu1.luigisbox.ai/platform/v1/banners/lbbn_7h3k9w' \ -H 'Authorization: Bearer ' \ -H 'If-Match: "1"' \ -H 'Content-Type: application/json' \ -d '{ "name": "Northwear autumn strip, week 2" }' ``` A `version` that is no longer current is a `412` and changes nothing: read the banner again and reapply the change. A request without `If-Match` is a `428`. See [Headers](/api-basics/requests-and-responses/#on-the-request). `null` clears `html` or `metadata`, and the banner must keep one of them. `organization_id` cannot be sent. An image sent in a `PATCH` is added, or replaces the banner's image of the same name and keeps its ID. A banner keeps only the images its `html` names: `html` that stops naming an image removes it, and clearing `html` removes them all. A replaced or removed image stays at its URL until the banner is archived, so a page still showing an earlier version of the banner keeps working. Editing a banner changes what every campaign showing it serves. | Situation | Result | |---|---| | A `PATCH` that names no field and carries no image | `422`, `error_code` `entity_change_empty` | | Neither `html` nor `metadata` left | `422`, type `banner_content_required` | | `html` over 64 KB | `422`, type `banner_html_too_large` | | A `metadata` string with a control character, invisible mark or bidirectional override | `422`, type `banner_metadata_value_unprintable` | | A `metadata` integer outside ±9,007,199,254,740,991 | `422`, type `banner_metadata_integer_out_of_range` | | `metadata` over 64 KB | `422`, type `banner_metadata_too_large` | | A `metadata` string a browser reads as a `javascript:`, `vbscript:` or `data:` URL | `422`, type `banner_metadata_value_unsafe_url` | | The name is taken by another banner of the organization | `409`, `error_code` `banner_name_taken` | | Updating or archiving an archived banner | `409`, `error_code` `banner_archived` | A `422` type is under `exception_details.validation_errors`; a `409` code, and `entity_change_empty`, under `exception_details.error_code`. ### HTML A banner's `html` is served as written, scripts included, from a URL we host. Each `lbx-image:` in it is replaced with the image's URL. Sending `html` needs the `platform:banner:script` permission on top of the permission to create or edit the banner. Without it the write is a `403` naming the permission. Clearing `html` with `null` does not need it. ### Permissions | Permission | Allows | |---|---| | `platform:banner:read` | Getting and listing banners | | `platform:banner:create` | Creating banners | | `platform:banner:write` | Editing banners, adding and removing images | | `platform:banner:delete` | Archiving banners | | `platform:banner:script` | Sending `html`, with `platform:banner:create` or `platform:banner:write` | Each is granted on an organization or on one banner. Permissions over an organization's catalogs, channels and surfaces do not reach its banners. ### Archiving `DELETE /platform/v1/banners/{banner_id}`, with the `version` in `If-Match`, archives the banner and answers `204`. An archived banner stays readable with `"status": "archived"`, cannot be updated, frees its name for another banner, and has its images and html pages deleted, including ones replaced or removed earlier. There is no un-archive. A banner cannot be archived while a campaign that is not archived shows it: the request is a `409` with `error_code` `banner_in_use`, and `exception_details.campaign_ids` lists those campaigns. Remove the banner rule from them, or archive them, first. Later pages of a result list carry the banners chosen for its first page, so a shopper already paging through results can still get a banner on those pages for a while after its campaign stops showing it. If the banner is archived in that time, its `html_url` no longer loads there and its frame stays empty; a `metadata` banner still shows in full. ## Showing a banner A banner shows through a campaign rule whose effect is `banner`. The campaign's [targeting](/merchandising/business-rules/targeting/), [trigger](/merchandising/business-rules/triggers/) and schedule decide which requests it fires on, as for any other rule. ```json { "organization_id": "lbo_r2vn8c", "name": "Northwear autumn banner", "status": "active", "catalog_ids": ["lbc_8w3k2p"], "intents": ["search"], "match": { "operator": "and", "conditions": [ { "field": "trigger.request:query", "operator": "matches", "value": "northwear" }, { "field": "trigger.request:touchpoint", "operator": "eq", "value": "serp" } ] }, "rules": [ { "name": "Autumn hero above the results", "effect": { "type": "banner", "banner_id": "lbbn_7h3k9w", "area": "above_results" } } ] } ``` | Field | Required | Notes | |---|---|---| | `banner_id` | Yes | A banner of the campaign's organization that is not archived | | `area` | Yes | Where on the page it shows: `above_results`, `below_results`, `header`, `in_grid`, `in_filters` | | `position` | For `in_grid` | The 1-based cell the banner takes, counted over the whole result list: with 24 results a page, position 30 is the sixth cell of the second page | To show a banner at some touchpoints only, add a `trigger.request:touchpoint` condition to the campaign's [trigger](/merchandising/business-rules/triggers/), as above. A campaign without a touchpoint condition shows its banners at every touchpoint. Every area shows at every touchpoint, `autocomplete` included, where your panel decides where each area sits. Every in-grid banner takes exactly one cell. A banner rule selects no products, so it takes no `record_match`. Leave it out; an empty condition list is accepted too. It counts toward the campaign's 50 rules, and a campaign can mix banner rules with pins, bans, boosts and buries. Banners show on search and collection requests, so the campaign's targeting has to reach the `search` or `collection` intent. Creating a campaign with banner rules, or sending banner rules in an update, needs `platform:banner:read` on the organization on top of the campaign permissions; without it the write is a `403`. An update re-checks the banner rules only when it changes `rules`, `match` or the targeting; a status change checks none of them. | Situation | Result | |---|---| | An `in_grid` banner without `position` | `422`, type `banner_position_required` | | `position` on any other area | `422`, type `banner_position_not_allowed` | | A `record_match` with conditions | `422`, type `banner_record_match_not_allowed` | | A banner that is archived or belongs to another organization | `422`, type `banner_not_found` | | Targeting that reaches neither `search` nor `collection` | `422`, type `banner_intent_unsupported` | | A trigger allowing only touchpoints that serve none of the `search` or `collection` intents the targeting reaches, such as `autocomplete` on a `collection`-only campaign | `422`, type `banner_touchpoint_unreachable` | ### One banner per area A response shows at most one banner per area, and in the grid one per position. When several campaigns would show a banner in the same area, one wins in this order: on a collection page, the campaign set on the collection closest to the page; then the newer campaign; within one campaign, the rule listed first. Product rules that do the same thing follow [the same order](/merchandising/business-rules/conflicts/#the-order). ### Common setups **A banner and the products it advertises.** One campaign holds both, so they start and stop together. Its trigger leaves out `trigger.request:touchpoint`, so the banner shows at every touchpoint the campaign reaches: ```json "rules": [ { "name": "Autumn hero", "effect": { "type": "banner", "banner_id": "lbbn_7h3k9w", "area": "above_results" } }, { "name": "Northwear first", "record_match": { "operator": "and", "conditions": [{ "field": "brand", "operator": "eq", "value": "brand/northwear" }] }, "effect": { "type": "boost", "strength_pct": 0.5 } } ] ``` **A brand banner on a category page.** Target the `collection` intent and trigger on the category's collection: ```json "intents": ["collection"], "match": { "operator": "and", "conditions": [ { "field": "trigger.request:collection_id", "operator": "eq", "value": "collection:category/tvs/member:product" } ] }, "rules": [ { "name": "Brand header", "effect": { "type": "banner", "banner_id": "lbbn_7h3k9w", "area": "header" } } ] ``` **A banner in the autocomplete panel.** Trigger on the `autocomplete` touchpoint, so the banner stays out of the results page. Any area works; an `in_grid` banner takes a cell among the suggestions. A pin, ban, boost or bury in the same campaign applies in the panel only too: ```json "match": { "operator": "and", "conditions": [ { "field": "trigger.request:query", "operator": "matches", "value": "northwear" }, { "field": "trigger.request:touchpoint", "operator": "eq", "value": "autocomplete" } ] }, "rules": [ { "name": "Panel strip", "effect": { "type": "banner", "banner_id": "lbbn_7h3k9w", "area": "above_results" } } ] ``` **A banner your own front end draws.** Give the banner `metadata` only, such as a headline, an image URL and a link, and ask for it with `"banner_format": "metadata"`. No frame is involved. To show a banner's `html` on your page, see [Displaying banners](/merchandising/business-rules/displaying-banners/). ## Banners in the response [`POST /discovery/v1/search`](/discovery/search/) and [`POST /discovery/v1/collection`](/discovery/collection/) carry a `banners` array. The body field `banner_format` asks for banners and chooses which form of each comes back. A request without it gets no banners. | `banner_format` | Each banner carries | |---|---| | `html` | `html_url` | | `metadata` | `metadata` | | `all` | Both, for the forms the banner has | A banner without the requested form is left out: a `metadata`-only banner does not appear in a response asking for `html`. ```bash curl -X POST 'https://api.eu1.luigisbox.ai/discovery/v1/search?channel_id=lbn_4hj9tv&surface_id=lbs_search_main' \ -H 'Authorization: Bearer ' \ -H 'X-Lbx-Visitor-Id: 8f14e45f-ea0f-4b5c-9a1d-2b3c4d5e6f70' \ -H 'Content-Type: application/json' \ -d '{ "type": "product", "touchpoint": "serp", "query": "northwear jacket", "banner_format": "metadata" }' ``` ```json { "hits": [ … ], "banners": [ { "banner_id": "lbbn_7h3k9w", "campaign_id": "lbm_p7q2zx", "rule_id": "lbr_2m8xkd", "area": "above_results", "metadata": { "headline": "Northwear autumn: 30 % off", "target_url": "https://example.com/northwear", "discount_pct": 30 } } ], "total": 86, "total_approx": 86, "request_key": "5d1e8a0c47b2f9368c1a4e07", "guid": "5d1e8a0c47b2f9368c1a4e07", "next_page_cursor": "eyJvIjoxMCwic…", "pagination_status": "more" } ``` | Field | Meaning | |---|---| | `banner_id` | The banner shown | | `campaign_id` | The campaign showing it | | `rule_id` | The campaign rule showing it | | `area` | Where on the page it shows, as the rule set it | | `position` | For an `in_grid` banner, the cell it takes on this page; see [In-grid banners](#in-grid-banners). Absent for every other area. | | `html_url` | The URL of the banner's hosted HTML, to show in a frame. Its fragment names the catalog's language, as a BCP 47 tag such as `#language=de-DE`; see [Language](/merchandising/business-rules/displaying-banners/#language). Present when `banner_format` is `html`, or `all` and the banner has `html`. | | `metadata` | The banner's key-value object, as written. Present when `banner_format` is `metadata`, or `all` and the banner has `metadata`. Escape its values before putting them into markup, and accept only `https:` URLs in `href` or `src`. | | `@disclosure` | The campaign's [disclosure](/discovery/overview/#disclosed-placements), when the campaign is disclosed. Absent otherwise, never `null`. | `banners` is always present, and empty when no banner applies. Banners come in the order their campaigns are ranked, at most one per area, and in the grid one per cell. - **Touchpoint.** A request without a `touchpoint` gets no banners. A campaign chooses the touchpoints its banners show at with its trigger. - **Pages.** Every page of a result list carries the same banners outside the grid, the ones chosen for its first page, so each response is enough to render its page. A client that appends pages to one list shows them once. - **Sorting.** An explicit `sort` turns off pins, boosts and buries, but keeps banners. - **Other endpoints.** The deprecated `GET` forms of search and collection always return an empty `banners` list. Recommender responses carry no banners. ### In-grid banners An `in_grid` banner takes one cell of the result grid. Its rule's `position` counts cells over the whole result list, hits and in-grid banners alike, and each page carries the in-grid banners whose cells fall on it, with `position` giving the cell on that page. `size` counts the page's cells, banners included, so a page returns one hit fewer for each in-grid banner it carries: with `"size": 24` and a banner at position 30, the second page carries the banner at `position` 6 and 23 hits. Lay the page out by placing each banner at its `position` and filling the other cells with the hits, in order. - **No hit is skipped.** The `next_page_cursor` continues from the last hit returned. - **Pins count hits, not cells.** A pin at position 24 with `"size": 24` and one in-grid banner on the first page lands on page 2, as its 1st hit. - **Keep `size` the same on every page.** The cells are counted with each request's `size`; a list paged with changing sizes can show a banner a cell or so from its position. - **A page keeps at least one hit.** It shows at most `size` − 1 in-grid banners, and none more than one cell after its last hit, as on a short last page. A page with no hits can still show a banner in its first cell. - **Autocomplete** shows in-grid banners in the cells of the suggestions it returns. To keep a banner for autocomplete, trigger its campaign on `trigger.request:touchpoint` `eq` `autocomplete`. ## See also - [Displaying banners](/merchandising/business-rules/displaying-banners/) — showing a banner's `html_url` in a frame on your page - [Rules and effects](/merchandising/business-rules/rules-and-effects/) — the product effects a rule can have instead - [Authoring API](/merchandising/business-rules/authoring-api/) — creating and updating campaigns - [Touchpoints](/concepts/domain-model/#touchpoints) — the values a request declares