Skip to content

    Pre-launch API. The concepts described here are settled, but the API shape is not: request and response fields, parameters and defaults can still change. Build against it, and talk to your Luigi's Box contact before you put an integration into production.

    Update a banner

    View source
    PATCH
    /platform/v1/banners/{banner_id}
    curl --request PATCH \
    --url https://api.eu1.luigisbox.ai/platform/v1/banners/example \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --header 'If-Match: example' \
    --data '{ "html": "example", "metadata": { "additionalProperty": "example" }, "name": "example" }'

    Change the fields sent; null clears html or metadata, but the banner must keep one of them. Images sent in a multipart/form-data request are added, or replace the banner’s images of the same name, keeping their ids; the banner keeps only the images its html names. Sending html needs platform:banner:script. An archived banner cannot be updated. A request that names no field and carries no image is a 422 with error_code entity_change_empty. Every change gives the banner a new version.

    banner_id
    required
    Banner Id

    The banner’s id, lbbn_ followed by six characters.

    string

    The banner’s id, lbbn_ followed by six characters.

    If-Match
    required
    If-Match
    string
    /^"[1-9][0-9]{0,18}"$/

    The version of the resource the change is based on, a positive integer in double quotes, e.g. "42". Missing or * is a 428; any other value is a 422 with validation_errors[].type entity_version_malformed.

    BannerUpdate

    Partial update (JSON Merge Patch). Only fields present in the request are applied.

    organization_id is immutable and not accepted. The banner left after the update must still hold html or metadata. An archived banner cannot be updated.

    object
    html
    Html

    The banner as HTML markup, served as written at its own URL, scripts included. Setting it needs the platform:banner:script permission. At most 64 KB in UTF-8; a larger one is rejected with the validation error type banner_html_too_large. A banner holds html, metadata or both; one without either is rejected with banner_content_required. It refers to the banner’s images as lbx-image:<name>, e.g. <img src="lbx-image:hero.jpg">; a name without an image is rejected with banner_image_not_found. null clears it.

    Any of:
    string
    >= 1 characters
    metadata
    Metadata

    Metadata of the banner, a flat key-value object for the client’s own code, e.g. {"headline": "Nike -30 %", "image_url": "https://…", "target_url": "https://…"}. At most 20 keys of 1 to 64 characters from A-Z a-z 0-9 _ . : -. A value is a string of at most 2048 characters, a number or a boolean; an integer outside ±9007199254740991 is rejected with banner_metadata_integer_out_of_range. At most 64 KB in total as compact JSON in UTF-8 (banner_metadata_too_large). A string with a control character, invisible mark or bidirectional override is rejected with banner_metadata_value_unprintable, and one a browser would read as a javascript:, vbscript: or data: URL with banner_metadata_value_unsafe_url. Values are returned as written: escape them before putting them into markup. Replaced whole, never merged key by key; null clears it.

    Any of:
    object
    >= 1 properties <= 20 properties
    key
    additional properties
    Any of:
    string
    <= 2048 characters
    name
    Name

    Name of the banner, unique among the organization’s banners that are not archived.

    string
    >= 1 characters <= 256 characters

    Example generated

    {
    "html": "example",
    "metadata": {
    "additionalProperty": "example"
    },
    "name": "example"
    }

    Successful Response

    Media typeapplication/json
    Banner

    Promotional content an organization shows on its results pages, as html, metadata or both.

    object
    created_at
    required
    Created At

    When the banner was created.

    string format: date-time
    created_by
    required
    Created By

    The user who created the banner, if a user did.

    Any of:
    string
    html
    required
    Html

    The banner as HTML markup, served as written at its own URL, scripts included. Setting it needs the platform:banner:script permission. At most 64 KB in UTF-8; a larger one is rejected with the validation error type banner_html_too_large. A banner holds html, metadata or both; one without either is rejected with banner_content_required. It refers to the banner’s images as lbx-image:<name>, e.g. <img src="lbx-image:hero.jpg">; a name without an image is rejected with banner_image_not_found.

    Any of:
    string
    html_url
    required
    Html Url

    The public URL the banner’s html is hosted at, its image placeholders replaced with the images’ URLs. Each change to the page gives a new URL. null when the banner has no html or is archived.

    Any of:
    string
    id
    required
    Id

    Banner id, lbbn_ followed by six characters.

    string
    images
    required
    Images

    The images the html refers to, by name. At most 10 per banner, each a JPEG, PNG, GIF or WebP file of at most 1 MB and 4096 × 4096 pixels. They are uploaded as images parts of a multipart/form-data create or update, each named by the filename of its part, which the client chooses: 1 to 64 characters from A-Z a-z 0-9 _ . -. An upload the html does not name is rejected with banner_image_unused. The banner keeps only the images its html names, so html that stops naming an image removes it; a removed image stays served at its URL until the banner is archived. Ordered by name.

    Array<object>
    BannerImage

    An image stored with a banner, which its html refers to by name.

    object
    content_type
    required
    ImageContentType

    The image’s media type, read from its bytes.

    string
    Allowed values: image/jpeg image/png image/gif image/webp
    created_at
    required
    Created At

    When the image was uploaded.

    string format: date-time
    height
    required
    Height

    The image’s height in pixels.

    integer
    id
    required
    Id

    Image id, kept when an upload replaces it.

    string format: uuid
    name
    required
    Name

    The image’s name within the banner, the file name it was uploaded under.

    string
    size_bytes
    required
    Size Bytes

    The image’s size in bytes.

    integer
    url
    required
    Url

    The public URL the image is served at.

    string
    width
    required
    Width

    The image’s width in pixels.

    integer
    metadata
    required
    Metadata

    Metadata of the banner, a flat key-value object for the client’s own code, e.g. {"headline": "Nike -30 %", "image_url": "https://…", "target_url": "https://…"}. At most 20 keys of 1 to 64 characters from A-Z a-z 0-9 _ . : -. A value is a string of at most 2048 characters, a number or a boolean; an integer outside ±9007199254740991 is rejected with banner_metadata_integer_out_of_range. At most 64 KB in total as compact JSON in UTF-8 (banner_metadata_too_large). A string with a control character, invisible mark or bidirectional override is rejected with banner_metadata_value_unprintable, and one a browser would read as a javascript:, vbscript: or data: URL with banner_metadata_value_unsafe_url. Values are returned as written: escape them before putting them into markup.

    Any of:
    object
    key
    additional properties
    Any of:
    string
    name
    required
    Name

    Name of the banner, unique among the organization’s banners that are not archived.

    string
    organization_id
    required
    Organization Id

    The organization the banner belongs to.

    string
    status
    required
    BannerStatus

    archived is terminal: an archived banner cannot be updated.

    string
    Allowed values: active archived
    updated_at
    required
    Updated At

    When the banner was last changed.

    string format: date-time
    updated_by
    required
    Updated By

    The user who last changed the banner, if a user did.

    Any of:
    string
    version
    required
    Version

    The banner’s version, an opaque value that changes on every change to the banner. An update or archive names the version it is based on in If-Match, as "<version>".

    integer format: int64
    >= 1

    Example

    {
    "images": [
    {
    "content_type": "image/jpeg"
    }
    ],
    "status": "active"
    }
    ETag
    string
    /^"[1-9][0-9]{0,18}"$/

    The resource’s version in double quotes, e.g. "42". Send it back in If-Match.

    Malformed request

    Media typeapplication/json
    ErrorResponse

    Canonical error body — every non-2xx response uses this shape.

    object
    exception_details
    ExceptionDetails

    Machine-readable error context; empty object when there is nothing to add.

    object
    error_code
    Error Code

    Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. filter_unknown_field or cursor_mismatch. Safe to branch on; reason is not. Absent when the status code says all there is to say.

    string
    validation_errors
    Validation Errors

    Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value.

    Array<object>
    ValidationProblem

    One field-level reason a request was rejected.

    object
    loc
    required
    Loc

    Path to the offending value from the request root, e.g. ["body", "filters", 0, "operator"].

    Array
    msg
    required
    Msg

    What is wrong with the value at loc.

    string
    type
    required
    Type

    Stable machine code for the problem, e.g. missing or string_too_short.

    string
    key
    additional properties
    any
    reason
    required
    Reason

    Human-readable, actionable error message.

    string
    request_id
    Request Id

    Request correlation ID (matches the X-Request-Id response header).

    Any of:
    string

    Example generated

    {
    "exception_details": {
    "error_code": "example",
    "validation_errors": [
    {
    "loc": [
    "example"
    ],
    "msg": "example",
    "type": "example"
    }
    ]
    },
    "reason": "example",
    "request_id": "example"
    }

    Missing or invalid credentials

    Media typeapplication/json
    ErrorResponse

    Canonical error body — every non-2xx response uses this shape.

    object
    exception_details
    ExceptionDetails

    Machine-readable error context; empty object when there is nothing to add.

    object
    error_code
    Error Code

    Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. filter_unknown_field or cursor_mismatch. Safe to branch on; reason is not. Absent when the status code says all there is to say.

    string
    validation_errors
    Validation Errors

    Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value.

    Array<object>
    ValidationProblem

    One field-level reason a request was rejected.

    object
    loc
    required
    Loc

    Path to the offending value from the request root, e.g. ["body", "filters", 0, "operator"].

    Array
    msg
    required
    Msg

    What is wrong with the value at loc.

    string
    type
    required
    Type

    Stable machine code for the problem, e.g. missing or string_too_short.

    string
    key
    additional properties
    any
    reason
    required
    Reason

    Human-readable, actionable error message.

    string
    request_id
    Request Id

    Request correlation ID (matches the X-Request-Id response header).

    Any of:
    string

    Example generated

    {
    "exception_details": {
    "error_code": "example",
    "validation_errors": [
    {
    "loc": [
    "example"
    ],
    "msg": "example",
    "type": "example"
    }
    ]
    },
    "reason": "example",
    "request_id": "example"
    }

    Authenticated but not permitted

    Media typeapplication/json
    ErrorResponse

    Canonical error body — every non-2xx response uses this shape.

    object
    exception_details
    ExceptionDetails

    Machine-readable error context; empty object when there is nothing to add.

    object
    error_code
    Error Code

    Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. filter_unknown_field or cursor_mismatch. Safe to branch on; reason is not. Absent when the status code says all there is to say.

    string
    validation_errors
    Validation Errors

    Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value.

    Array<object>
    ValidationProblem

    One field-level reason a request was rejected.

    object
    loc
    required
    Loc

    Path to the offending value from the request root, e.g. ["body", "filters", 0, "operator"].

    Array
    msg
    required
    Msg

    What is wrong with the value at loc.

    string
    type
    required
    Type

    Stable machine code for the problem, e.g. missing or string_too_short.

    string
    key
    additional properties
    any
    reason
    required
    Reason

    Human-readable, actionable error message.

    string
    request_id
    Request Id

    Request correlation ID (matches the X-Request-Id response header).

    Any of:
    string

    Example generated

    {
    "exception_details": {
    "error_code": "example",
    "validation_errors": [
    {
    "loc": [
    "example"
    ],
    "msg": "example",
    "type": "example"
    }
    ]
    },
    "reason": "example",
    "request_id": "example"
    }

    Resource not found

    Media typeapplication/json
    ErrorResponse

    Canonical error body — every non-2xx response uses this shape.

    object
    exception_details
    ExceptionDetails

    Machine-readable error context; empty object when there is nothing to add.

    object
    error_code
    Error Code

    Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. filter_unknown_field or cursor_mismatch. Safe to branch on; reason is not. Absent when the status code says all there is to say.

    string
    validation_errors
    Validation Errors

    Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value.

    Array<object>
    ValidationProblem

    One field-level reason a request was rejected.

    object
    loc
    required
    Loc

    Path to the offending value from the request root, e.g. ["body", "filters", 0, "operator"].

    Array
    msg
    required
    Msg

    What is wrong with the value at loc.

    string
    type
    required
    Type

    Stable machine code for the problem, e.g. missing or string_too_short.

    string
    key
    additional properties
    any
    reason
    required
    Reason

    Human-readable, actionable error message.

    string
    request_id
    Request Id

    Request correlation ID (matches the X-Request-Id response header).

    Any of:
    string

    Example generated

    {
    "exception_details": {
    "error_code": "example",
    "validation_errors": [
    {
    "loc": [
    "example"
    ],
    "msg": "example",
    "type": "example"
    }
    ]
    },
    "reason": "example",
    "request_id": "example"
    }

    The banner is archived, or a banner that is not archived already has the name.

    Media typeapplication/json
    BannerConflictError

    The canonical error body of a refused banner write, with error_code typed.

    object
    exception_details
    required
    BannerConflictDetails

    The exception_details of a refused banner write, naming why it was refused.

    object
    campaign_ids
    Campaign Ids

    On banner_in_use, the campaigns that are not archived and show the banner.

    Array<string>
    error_code
    required
    BannerConflictCode

    Why the write was refused.

    string
    Allowed values: banner_name_taken banner_archived banner_in_use
    validation_errors
    Validation Errors

    Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value.

    Array<object>
    ValidationProblem

    One field-level reason a request was rejected.

    object
    loc
    required
    Loc

    Path to the offending value from the request root, e.g. ["body", "filters", 0, "operator"].

    Array
    msg
    required
    Msg

    What is wrong with the value at loc.

    string
    type
    required
    Type

    Stable machine code for the problem, e.g. missing or string_too_short.

    string
    key
    additional properties
    any
    reason
    required
    Reason

    Human-readable, actionable error message.

    string
    request_id
    Request Id

    Request correlation ID (matches the X-Request-Id response header).

    Any of:
    string

    Example

    {
    "exception_details": {
    "error_code": "banner_name_taken"
    }
    }

    Version not current

    Media typeapplication/json
    PreconditionFailedResponse

    The canonical error body of a 412, with exception_details typed.

    object
    exception_details
    required
    PreconditionFailedDetails

    Why the write was refused, and the entity’s current version.

    object
    current_version
    required
    Current Version

    The entity’s current version. Read the entity again, reapply the change and resend it.

    integer format: int64
    >= 1
    error_code
    required
    Error Code

    The entity changed since the version the request was based on.

    string
    Allowed value: entity_version_stale
    reason
    required
    Reason

    Human-readable, actionable error message.

    string
    request_id
    Request Id

    Request correlation ID (matches the X-Request-Id response header).

    Any of:
    string

    Example

    {
    "exception_details": {
    "error_code": "entity_version_stale"
    }
    }
    ETag
    string
    /^"[1-9][0-9]{0,18}"$/

    The resource’s version in double quotes, e.g. "42". Send it back in If-Match.

    Request body too large

    Media typeapplication/json
    ErrorResponse

    Canonical error body — every non-2xx response uses this shape.

    object
    exception_details
    ExceptionDetails

    Machine-readable error context; empty object when there is nothing to add.

    object
    error_code
    Error Code

    Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. filter_unknown_field or cursor_mismatch. Safe to branch on; reason is not. Absent when the status code says all there is to say.

    string
    validation_errors
    Validation Errors

    Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value.

    Array<object>
    ValidationProblem

    One field-level reason a request was rejected.

    object
    loc
    required
    Loc

    Path to the offending value from the request root, e.g. ["body", "filters", 0, "operator"].

    Array
    msg
    required
    Msg

    What is wrong with the value at loc.

    string
    type
    required
    Type

    Stable machine code for the problem, e.g. missing or string_too_short.

    string
    key
    additional properties
    any
    reason
    required
    Reason

    Human-readable, actionable error message.

    string
    request_id
    Request Id

    Request correlation ID (matches the X-Request-Id response header).

    Any of:
    string

    Example generated

    {
    "exception_details": {
    "error_code": "example",
    "validation_errors": [
    {
    "loc": [
    "example"
    ],
    "msg": "example",
    "type": "example"
    }
    ]
    },
    "reason": "example",
    "request_id": "example"
    }

    Request validation failed. Each problem is listed in exception_details.validation_errors, under a typed code. A request that changes nothing has none listed.

    Media typeapplication/json
    Response 422 Update Banner
    Any of:
    BannerValidationError

    The canonical error body of a banner write that failed field validation, its codes typed.

    object
    exception_details
    required
    BannerValidationDetails

    The exception_details of a banner write that failed field validation.

    object
    error_code
    Error Code

    Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. filter_unknown_field or cursor_mismatch. Safe to branch on; reason is not. Absent when the status code says all there is to say.

    string
    validation_errors
    required
    Validation Errors

    Every field-level problem found, each naming where in the body it sits.

    Array<object>
    BannerValidationProblem

    One field-level reason a banner write was rejected, with its banner codes published.

    object
    loc
    required
    Loc

    Path to the offending value from the request root, e.g. ["body", "filters", 0, "operator"].

    Array
    msg
    required
    Msg

    What is wrong with the value at loc.

    string
    type
    required
    Type

    Stable machine code for the problem: one of the banner codes listed here, or a generic one such as missing or string_too_long.

    Any of:
    BannerProblemCode

    The stable machine codes a rejected banner is reported under.

    string
    Allowed values: banner_content_required banner_form_invalid banner_html_too_large banner_metadata_too_large banner_metadata_integer_out_of_range banner_metadata_value_unprintable banner_metadata_value_unsafe_url
    key
    additional properties
    any
    reason
    required
    Reason

    Human-readable, actionable error message.

    string
    request_id
    Request Id

    Request correlation ID (matches the X-Request-Id response header).

    Any of:
    string

    Example

    {
    "exception_details": {
    "validation_errors": [
    {
    "type": "banner_content_required"
    }
    ]
    }
    }

    Version required

    Media typeapplication/json
    PreconditionRequiredResponse

    The canonical error body of a 428, with exception_details typed.

    object
    exception_details
    required
    PreconditionRequiredDetails

    Why the write was refused.

    object
    error_code
    required
    Error Code

    The request’s If-Match named no version it was based on: it was absent or *.

    string
    Allowed value: entity_version_required
    reason
    required
    Reason

    Human-readable, actionable error message.

    string
    request_id
    Request Id

    Request correlation ID (matches the X-Request-Id response header).

    Any of:
    string

    Example

    {
    "exception_details": {
    "error_code": "entity_version_required"
    }
    }

    Service temporarily unavailable

    Media typeapplication/json
    ErrorResponse

    Canonical error body — every non-2xx response uses this shape.

    object
    exception_details
    ExceptionDetails

    Machine-readable error context; empty object when there is nothing to add.

    object
    error_code
    Error Code

    Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. filter_unknown_field or cursor_mismatch. Safe to branch on; reason is not. Absent when the status code says all there is to say.

    string
    validation_errors
    Validation Errors

    Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value.

    Array<object>
    ValidationProblem

    One field-level reason a request was rejected.

    object
    loc
    required
    Loc

    Path to the offending value from the request root, e.g. ["body", "filters", 0, "operator"].

    Array
    msg
    required
    Msg

    What is wrong with the value at loc.

    string
    type
    required
    Type

    Stable machine code for the problem, e.g. missing or string_too_short.

    string
    key
    additional properties
    any
    reason
    required
    Reason

    Human-readable, actionable error message.

    string
    request_id
    Request Id

    Request correlation ID (matches the X-Request-Id response header).

    Any of:
    string

    Example generated

    {
    "exception_details": {
    "error_code": "example",
    "validation_errors": [
    {
    "loc": [
    "example"
    ],
    "msg": "example",
    "type": "example"
    }
    ]
    },
    "reason": "example",
    "request_id": "example"
    }