OCAPI flash 23.1

Flash is a property of documents and contains special information about the document.

Such information could be:

It is currently only used at the basket document. The presence of a flash indicates a reason why the basket cannot yet be submitted. See examples of basket resource.

In the Scripting API, flashes can be read from, added to or removed from a document using the methods addFlash, removeFlash and flashes or getFlashes(). Flashes can be added to any object within the structure of the document - for example a flash may be added to the baskets billing address with the path $.post_code or to one of the baskets product items with path $.adjusted_price. Before sending the response to the client, such flashes are aggregated to the document and their paths are adjusted appropriately, in our example to $.billing_address.post_code and $.product_items[0].adjusted_price.

Example usage showing addition, listing, and removal of flashes:

exports.validateBasket = function(basketResponse) {
       type: "MyType",
       message: "My message",
       path: "my_path",
       details: {
           "k1": "v1",
           "k2": "v2"
    var flashToRemove;
    for each(f in basketResponse.flashes) {
      if (f.type == "SomeOtherType") {
        flashToRemove = f;
    if (flashToRemove != null) {
X OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.