Autosuggest API v1 [deprecated]

📘

This is the reference page for the Autosuggest v1 API, and should only be used if you integrated Autosuggest before October 7, 2020.

Endpoints

Production: https://suggest.dxpapi.com/api/v1/suggest/?
Staging: https://staging-suggest.dxpapi.com/api/v1/suggest/?

Example request and response

GET https://suggest.dxpapi.com/api/v1/suggest/?
account_id=<Bloomreach Provided Account ID>
&auth_key=jazzhands
&domain_key=example_com
&request_id=7546919099987
&_br_uid_2=uid%3D5917073780329%3A_uid%3D9737480431795%3Av%3D11.8%3Ats%3D1459840113832%3Ahc%3D37
&url=www.example.com
&ref_url=http://www.example.com/
&q=a
&request_type=suggest
{
"responseHeader": {
    "status": 0,
    "QTime": 0
},
"response": {
    "q": "a",
    "suggestions": [
        {
            "q": "atlas",
            "dq": "atlas",
            "filters": [
                {
                    "name": "Mountain Bars",
                    "value": "Mountain Bars",
                    "key": "Department"
                },
                {
                    "name": "Cranksets",
                    "value": "Cranksets",
                    "key": "Department"
                }
            ]
        },
        {
            "q": "raceface atlas",
            "dq": "raceface atlas"
        },
        {
            "q": "reynolds attack",
            "dq": "reynolds attack"
        },
        {
            "q": "fox attack q4 short",
            "dq": "fox attack q4 short"
        },
        {
            "q": "atlas handlebar",
            "dq": "atlas handlebar"
        }
    ],
    "numFound": 21
}
}
GET https://suggest.dxpapi.com/api/v1/suggest/?
account_id=<Bloomreach Provided Account ID>
&auth_key=
&domain_key=example_com
&request_id=7546919099987
&_br_uid_2=uid%3D5917073780329%3A_uid%3D9737480431795%3Av%3D11.8%3Ats%3D1459840113832%3Ahc%3D37
&url=www.example.com
&ref_url=http://www.example.com/
&q=pen
&request_type=suggest
{
    "responseHeader":
        {
            "status": 0,
            "QTime": 4
        },
    "response": {"q": "pen",
    "suggestions":
    [
        {"q": "pens","dq": "pens",
            "filters": [{"name": "Pens","value": "Pens","key": "Department"}]},
        {"q": "pencils","dq": "pencils",
        {"q": "mechanical pencils","dq": "mechanical pencils"},
        {"q": "black pens","dq": "black pens"},
        {"q": "pencil sharpener","dq": "pencil sharpener"}
    ],
    "products":
    [
        {"pid":"354001283", "url":"http://www.example.com/pid=354001283?_br_psugg_q=pens", "title":"Blue fine point rollerball pen", "price":"28$","image_url":"www.example.com/354001283"},
        {"pid":"354001316", "url":"http://www.example.com/pid=354001316?_br_psugg_q=pens", "title":"Black fine point rollerball pen", "price":"28$","image_url":"www.example.com/354001316"}
        {"pid":"354001401", "url":"http://www.example.com/pid=354001401?_br_psugg_q=pens", "title":"Red fine point rollerball pen", "price":"28$","image_url":"www.example.com/354001401"}
        {"pid":"354030028", "url":"http://www.example.com/pid=354030028?_br_psugg_q=pens", "title":"Blue gel pen", "price":"31$","image_url":"www.example.com/354030028"}
        {"pid":"354030041", "url":"http://www.example.com/pid=354030041?_br_psugg_q=pens", "title":"Black gel pen", "price":"31$","image_url":"www.example.com/354030041"}
    ]
    }
}

Suggestions

The list of suggestions in the response is in the response JSON object. The value of the suggestions field is an array of suggested queries and associated category suggestions. All queries are in this form:

"q": "suggested query",
"dq": "UI display query"

In the response, q field values are suggested queries and dq field values are display queries. A display query is the suggested query rendered for display in browsers.

Typically, q and dq values are the same. They usually differ when there are special characters in the q value that need to be rendered for your site visitors.

The dq values are relevant for displaying suggested queries in the browser. When your site visitor clicks a suggestion in the browser, that suggestion is the dq value. Upon clicking a suggestion, your site visitor initiates a search API call. That call is formed with the q value, not the dq value.

Suggestions with Categories

If an autosuggest query includes categories, then the response includes a filters array. This array helps your site visitors to filter their search results according to categories.

The fields in the JSON filters are name, value, and key. The values for these fields are all strings. The name field value is the suggestion displayed in browsers. The key and value fields form the filtered search API request when a site visitor clicks a suggestion.

Troubleshooting: Category suggestions aren't in my API response

Normally, your suggestion API responses include both suggested queries and suggested categories. Rarely, you might see only query suggestions returned, such as when the prefix isn't in the cache. As soon as a prefix is encountered, a cache entry is created, and both query and category suggestions are returned in responses. In the meantime, you need to make sure that your integration supports displaying only query suggestions.

Your Bloomreach representative can help you if you need more information.

Suggestions with Products

You can suggest products along with queries in your autosuggest API calls. When a visitor to your site begins typing a query, the autosuggest call retrieves a text-based list of queries as well as products. By default, the response includes a maximum of eight products.

rsp_fmt parameter

Your autosuggest API responses are returned in either format version 1 or version 2. Product suggestions require version 2.

If you're using version 1, then you can set &rsp_fmt=v2 when you need to use the new response format.

🚧

Check your format version

If you started your Commerce Search and Categories integration after October 2016, then your response format is in version 2 and you don't need the rsp_fmt parameter.

To confirm your format version, take a look at one of your autosuggest API responses. Version 1 has a spellcheck object, which includes a list of undifferentiated dq attribute-value pairs. Version 2 holds the data in a response object, which includes pairs of q and dq attribute-value pairs. Version 2 is easier to parse.

{
  "spellcheck": {
    "suggestions": [
      "lip",
      {
        "numFound": 80,
        "startOffset": 0,
        "endOffset": 5,
        "suggestion": [
          "dq=lipstick",
          "dq=lipgloss",
  
/* truncated */
  
        ]
      }
    ]
  }
}
{
   "response": {
    "q": "lip",
    "suggestions": [
      {
        "q": "lipgloss",
        "dq": "lipgloss"
      },
      {
        "q": "lipstick",
        "dq": "lipstick"
      },
    ],
  
/* truncated */
  
    "numFound": 80,
    "products": [
      {
        "url": "https://www.example.com/luscious-face-sheer-pout-touch-of-lip-color-c0999813065?_br_psugg_q=lipgloss",
        "sale_price": 21.99,
        "pid": "LFX345989",
        "thumb_image": "https://images.example.com/pics/catalog/product/cosmetics/lfsplc-LFX345989-color49-thumb.jpg",
        "title": "Lucious Face Sheer Pout Touch of Lip Color"
      },
      {
        "url": "https://www.example.com/shh-power-stance-full-coverage-lipstick-c0999659001?_br_psugg_q=lipstick",
        "sale_price": 17.29,
        "pid": "SXX450221",
        "thumb_image": "https://images.example.com/pics/catalog/product/cosmetics/spsfcl-SXX450221-mocha-thumb.jpg",
        "title": "Shh! Take a Power Stance Lipstick (full coverage)"
      }
  
/* truncated */
  
    ]
  }
}

_br_psugg_q attribute

When a site visitor selects a product suggestion, the product page opens. The URL for this product page must include the attribute, _br_psugg_q=autosuggest query from the API response, where autosuggest query is the first query suggestion. By default, product suggestions are powered by the first query suggestion. This attribute allows us to tag and track product suggestion sessions.

Typically, Bloomreach returns the product URL in the suggest API response and automatically adds the _br_psugg_q attribute. However, you need to confirm that the final URL for the product page includes this parameter, and append it to the URL if it's absent.

Troubleshooting: Product suggestions aren't in my API response

Normally, your suggestion API responses include both suggested queries and suggested products. Rarely, you might see only query suggestions returned, such as when the prefix isn't in the cache. As soon as a prefix is encountered, a cache entry is created and both query and product suggestions are returned in responses. In the meantime, you need to make sure that your integration supports displaying only query suggestions.

Your Bloomreach representative can help you if you need more information.

Query Params
int32
Defaults to 6702

Your site's numerical Bloomreach account ID. Your Bloomreach representative gives your site's account ID to you before or during your integration kickoff meeting.

The example value shown here, 6702, is included for your convenience to send a request with Try It.

string

The Bloomreach-provided authentication key for the Bloomreach account that's sending the request.

Autosuggest API calls are client-side, so you can leave auth_key empty.

string
Defaults to uid%3D7797686432023%3Av%3D11.5%3Ats%3D1428617911187%3Ahc%3D55

A first-party cookie created by the Bloomreach tracking pixel library (BrTrk). This cookie creates a unique, anonymous identifier for every browser or device.

Use the default value provided, which is already encoded.

string
Defaults to documentation_site

Your site domain's ID, which is provided by Bloomreach. This ID is for the domain that you want to receive your Bloomreach API requests. This parameter identifies the specific site version when the one account ID hosts multiple site versions with unique characteristics, such as language versions. Bloomreach uses your domain_key parameter value to ensure that only the data that pertains to that site version is used for query and analytics features, such as autosuggestions.

The example value shown here, documentation_site, is included for your convenience to send a request with Try It.

string
Defaults to cha

Your site visitor's partial search query that Autosuggest should operate on.

You can percent encode spaces between terms as %20, or you can leave the spaces unencoded.

The value shown here, cha, is included for your convenience to send a request with Try It.

string

The URL of the page or HTTP referrer where the request is started.

string

An ID to track site visitor clicks. We recommend that you generate unique, random values of 13 digits to enable click-tracking.

Bloomreach doesn't automatically enforce the requirements for this parameter. For example, you can enter test as your value for each instance of the request_id parameter without triggering an error message. However, using a unique value allows us to help you if you encounter a problem.

string
enum
Defaults to suggest

The type of API request. Value should be suggest for Autosuggest requests.

Allowed:
string
Defaults to https://www.documentation-site.com

The absolute URL of the page where the request is initiated. Do not use a relative URL.

The example value shown here, https://www.documentation-site.com, is included for your convenience to send a request with Try It.

Responses

Language
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json

© Bloomreach, Inc. All rights reserved.