V1 (deprecated)
4 min
The v1 APIs are now deprecated! If you are building a new implementation, we strongly recommend using API version 2 by going through V2 Overview
Depending on what details you want Klevu Search servers to return in response, you can use one of the following API methods to search in your index.
- For the “search as you type” sort of interface where you need query suggestions, matching categories, CMS pages and product suggestions, please use the “Search As You Type” method.
- For the search results landing page, if you only need a list of IDs of records relevant to your query, use the ID Search method.
- In addition to record IDs, if you want Klevu Search to return other details such as name, description, price, etc., use the Record Search method.
Both the ID Search and the Record Search methods have parameters that allow you to fetch filters/facets as well.
Search As You Type
Search as you type
Use this API endpoint to build a search as you type solution. It produces query suggestions, category suggestions, CMS page suggestions and products matching the customer query.
GET
https://<cloudSearchURL>/cloud-search/n-search/search
Query Parameters
- ticketstringrequiredDescription
- termstringrequiredDescription
- svstringrequiredDescription
- autoCompleteBooleanDescription
- typeOfSuggestionsstringDescription
- noOfResultsIntegerDescription
- noOfResultsACIntegerDescription
- enablePartialSearchBooleanDescription
- sortOrderstringDescription
- showOutOfStockProductsBooleanDescription
- priceFieldSuffixstringDescription
- visibilitystringDescription
- resultForZeroNumberDescription
- recentCategorystringDescription
- noOfResultsZeroIntegerDescription
- optionalFiltersstringDescription
- responseTypestringDescription
curl
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://eucs15.ksearchnet.com/cloud-search/n-search/search?ticket=klevu-156925593843210765&term=r&sv=20.0.0&autoComplete=false&autoCompleteFilters=category:cms&noOfResults=2&showOutOfStockProducts=false&responseType=json',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
200
{
"meta": {
"layoutId": "",
"layoutType": "",
"noOfResults": 2,
"paginationStartFrom": 0,
"powerdByLogo": "",
"totalResultsFound": 404,
"typeOfQuery": "WILDCARD_AND",
"storeBaseCurrency": "GBP",
"notificationCode": 1,
"term": "r",
"excludeIds": null,
"isPersonalised": false,
"idsUsedForPersonalisation": null
},
"result": [
{
"discount": "",
"hideGroupPrices": "",
"type": "Fitness Equipment",
"itemGroupId": "4384059883582",
"freeShipping": "",
"storeBaseCurrency": "GBP",
"price": "19.00",
"toPrice": "",
"imageUrl": "https://cdn.shopify.com/s/files/1/0116/9457/1582/products/ug05-gr-0_e8c85261-d103-4b09-9460-d8e0a2db97f5_medium.jpg?v=1575478397",
"currency": "GBP",
"inStock": "yes",
"id": "31366497206334",
"imageHover": "",
"sku": "24-UG05",
"brand": "KSD",
"startPrice": "",
"image": "https://cdn.shopify.com/s/files/1/0116/9457/1582/products/ug05-gr-0_e8c85261-d103-4b09-9460-d8e0a2db97f5_medium.jpg?v=1575478397",
"deliveryInfo": "",
"hideAddToCart": "",
"salePrice": "19.0",
"oldPrice": "19.0",
"swatches": {
"swatch": [],
"lowestPrice": "",
"numberOfAdditionalVariants": ""
},
"weight": "",
"klevu_category": "KLEVU_PRODUCT;Products;;Accessories;;Fitness Equipment @ku@kuCategory@ku@",
"totalVariants": "0",
"groupPrices": "",
"url": "https://jsv2-shopify-demo.ksearchmisc.com/products/go-getr-pushup-grips",
"tags": "Durable, Grips, pushup",
"name": "Go-Get'r Pushup Grips",
"shortDesc": "The Go-Get'r Pushup Grips safely provide the extra range of motion you need for a deep-dip routine targeting core, shoulder, chest and arm strength. Do fewer pushups using more energy, getting better results faster than the standard floor-level te",
"category": "Accessories;;Fitness Equipment",
"typeOfRecord": "KLEVU_PRODUCT"
},
{
"discount": "",
"hideGroupPrices": "",
"type": "Jackets",
"itemGroupId": "4384032915518",
"freeShipping": "",
"storeBaseCurrency": "GBP",
"price": "60.00",
"toPrice": "",
"imageUrl": "https://cdn.shopify.com/s/files/1/0116/9457/1582/products/wj05-red_main_f6c5dcb4-59e1-42cd-aeb6-3faf067c4935_medium.jpg?v=1575477999",
"currency": "GBP",
"inStock": "yes",
"id": "31366455066686",
"imageHover": "",
"sku": "WJ05-XS-Red",
"brand": "KKE",
"startPrice": "",
"image": "https://cdn.shopify.com/s/files/1/0116/9457/1582/products/wj05-red_main_f6c5dcb4-59e1-42cd-aeb6-3faf067c4935_medium.jpg?v=1575477999",
"deliveryInfo": "",
"hideAddToCart": "",
"salePrice": "60.0",
"oldPrice": "60.0",
"swatches": {
"swatch": [],
"lowestPrice": "",
"numberOfAdditionalVariants": ""
},
"weight": "",
"klevu_category": "KLEVU_PRODUCT;Products;;Jackets @ku@kuCategory@ku@",
"totalVariants": "0",
"groupPrices": "",
"url": "https://jsv2-shopify-demo.ksearchmisc.com/products/riona-full-zip-jacket-red",
"tags": "comfort, machine, royal, running, zipped",
"size": "Medium",
"name": "Riona Full Zip Jacket",
"shortDesc": "The Riona Basic Zip Jacket makes the perfect extra layer for cold-weather workouts. It features amazing breathability and moisture management, but full-length zipper lets you moderate your core temperature even more. • Brown heather full zi",
"category": "Jackets",
"typeOfRecord": "KLEVU_PRODUCT"
}
],
"filters": [],
"price": {
"min": "",
"max": "",
"start": "",
"end": ""
},
"autoComplete": [],
"popularTerm": [],
"pages": [
{
"discount": "",
"hideGroupPrices": "",
"type": "pages",
"itemGroupId": "page_50756288574",
"freeShipping": "",
"storeBaseCurrency": "EUR",
"price": "0.0",
"toPrice": "",
"imageUrl": "",
"currency": "EUR",
"inStock": "yes",
"id": "page_50756288574",
"imageHover": "",
"startPrice": "",
"image": "",
"deliveryInfo": "",
"hideAddToCart": "",
"salePrice": "0.0",
"oldPrice": "0.0",
"swatches": {
"swatch": [],
"lowestPrice": "",
"numberOfAdditionalVariants": ""
},
"weight": "",
"klevu_category": "KLEVU_CMS @ku@kuCategory@ku@",
"totalVariants": "0",
"groupPrices": "",
"url": "https://jsv2-shopify-demo.ksearchmisc.com/pages/recipe-fish-chips",
"name": "Recipe: Fish & Chips",
"shortDesc": "Just a test recipe for Fish & Chips.",
"typeOfRecord": "KLEVU_CMS"
},
{
"discount": "",
"hideGroupPrices": "",
"type": "pages",
"itemGroupId": "page_53478424638",
"freeShipping": "",
"storeBaseCurrency": "EUR",
"price": "0.0",
"toPrice": "",
"imageUrl": "",
"currency": "EUR",
"inStock": "yes",
"id": "page_53478424638",
"imageHover": "",
"startPrice": "",
"image": "",
"deliveryInfo": "",
"hideAddToCart": "",
"salePrice": "0.0",
"oldPrice": "0.0",
"swatches": {
"swatch": [],
"lowestPrice": "",
"numberOfAdditionalVariants": ""
},
"weight": "",
"klevu_category": "KLEVU_CMS @ku@kuCategory@ku@",
"totalVariants": "0",
"groupPrices": "",
"url": "https://jsv2-shopify-demo.ksearchmisc.com/pages/search-results",
"name": "Search Results",
"shortDesc": "",
"typeOfRecord": "KLEVU_CMS"
}
],
"categories": [],
"popularProducts": [],
"recentlyViewedProducts": [],
"ranges": [],
"error": {
"errorMessage": ""
}
}Record Search
Record search
Use this API method if you want not only the record IDs but also other details associated with the matching records. The method allows you to retrieve facets and autosuggestions as well.
GET
https://<cloudSearchURL>/cloud-search/n-search/search
Query Parameters
- ticketstringrequiredDescription
- termstringrequiredDescription
- svstringrequiredDescription
- paginationStartsFromIntegerDescription
- noOfResultsNumberDescription
- enablePartialSearchBooleanDescription
- categorystringDescription
- enableFiltersBooleanDescription
- enableMultiSelectFiltersBooleanDescription
- applyFiltersstringDescription
- maxNoOfValuesInAFilterIntegerDescription
- sortOrderstringDescription
- showOutOfStockProductsBooleanDescription
- fetchMinMaxPriceBooleanDescription
- priceFieldSuffixstringDescription
- visibilitystringDescription
- resultForZeroIntegerDescription
- recentCategorystringDescription
- noOfResultsZeroIntegerDescription
- optionalFiltersstringDescription
- responseTypestringDescription
- lsqtstringDescription
- flstringDescription
curl
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://eucs15.ksearchnet.com/cloud-search/n-search/search?ticket=klevu-156925593843210765&term=a&sv=20.0.0&paginationStartsFrom=0&noOfResults=2&enablePartialSearch=false&category=KLEVU_PRODUCT&enableFilters=false&enableMultiSelectFilters=false&showOutOfStockProducts=true&responseType=json',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
200
{
"meta": {
"layoutId": "",
"layoutType": "",
"noOfResults": 2,
"paginationStartFrom": 0,
"powerdByLogo": "",
"totalResultsFound": 448,
"typeOfQuery": "WILDCARD_AND",
"storeBaseCurrency": "GBP",
"notificationCode": 1,
"term": "a",
"excludeIds": null,
"isPersonalised": false,
"idsUsedForPersonalisation": null
},
"result": [
{
"discount": "",
"hideGroupPrices": "",
"type": "Watches",klevu
"itemGroupId": "4384059326526",
"freeShipping": "",
"storeBaseCurrency": "GBP",
"price": "45.00",
"toPrice": "",
"imageUrl": "https://cdn.shopify.com/s/files/1/0116/9457/1582/products/mg04-bk-0_b0a2adf9-f0c0-4814-8aa7-e421120afb06_medium.jpg?v=1575478388",
"currency": "GBP",
"inStock": "yes",
"id": "31366496616510",
"imageHover": "https://cdn.shopify.com/s/files/1/0116/9457/1582/products/mg04-bk-0_1024x1024_1_cb15759f-9c8c-4899-a68a-e379c5fe3735_medium.jpg?v=1575478388",
"sku": "24-MG04",
"brand": "KSD",
"startPrice": "",
"image": "https://cdn.shopify.com/s/files/1/0116/9457/1582/products/mg04-bk-0_b0a2adf9-f0c0-4814-8aa7-e421120afb06_medium.jpg?v=1575478388",
"deliveryInfo": "",
"hideAddToCart": "",
"salePrice": "45.0",
"oldPrice": "45.0",
"swatches": {
"swatch": [],
"lowestPrice": "",
"numberOfAdditionalVariants": ""
},
"weight": "",
"klevu_category": "KLEVU_PRODUCT;Products;;Watches @ku@kuCategory@ku@",
"totalVariants": "0",
"groupPrices": "",
"url": "https://jsv2-shopify-demo.ksearchmisc.com/products/aim-analog-watch",
"tags": "analog, strap fit, watch",
"size": "Free Size",
"name": "Aim Analog Watch",
"shortDesc": "Stay light-years ahead of the competition with our Aim Analog Watch. The flexible, rubberized strap is contoured to conform to the shape of your wrist for a comfortable all-day fit. The face features three illuminated hands, a digital read-out of",
"category": "Watches",
"typeOfRecord": "KLEVU_PRODUCT"
},
{
"discount": "",
"hideGroupPrices": "",
"type": "Watches",
"itemGroupId": "4384058933310",
"freeShipping": "",
"storeBaseCurrency": "GBP",
"price": "55.00",
"toPrice": "",
"imageUrl": "https://cdn.shopify.com/s/files/1/0116/9457/1582/products/mg05-br-0_5300c0c5-9008-480a-ab61-cd7a670d18e0_medium.jpg?v=1575478382",
"currency": "GBP",
"inStock": "yes",
"id": "31366496124990",
"imageHover": "",
"sku": "24-MG05",
"brand": "KSD",
"startPrice": "",
"image": "https://cdn.shopify.com/s/files/1/0116/9457/1582/products/mg05-br-0_5300c0c5-9008-480a-ab61-cd7a670d18e0_medium.jpg?v=1575478382",
"deliveryInfo": "",
"hideAddToCart": "",
"salePrice": "55.0",
"oldPrice": "55.0",
"swatches": {
"swatch": [],
"lowestPrice": "",
"numberOfAdditionalVariants": ""
},
"weight": "",
"klevu_category": "KLEVU_PRODUCT;Products;;Watches @ku@kuCategory@ku@",
"totalVariants": "0",
"groupPrices": "",
"url": "https://jsv2-shopify-demo.ksearchmisc.com/products/cruise-dual-analog-watch",
"tags": "analog, cruise, leather band, watch",
"size": "Free Size",
"name": "Cruise Dual Analog Watch",
"shortDesc": "Whether you're traveling or wish you were, you'll never let time zones perplex you again with the Cruise Dual Analog Watch. The thick, adjustable band promises a comfortable, personalized fit to this classy, modern time piece. Two dia",
"category": "Watches",
"typeOfRecord": "KLEVU_PRODUCT"
}
],
"filters": [],
"price": {
"min": "",
"max": "",
"start": "",
"end": ""
},
"autoComplete": [],
"popularTerm": [],
"pages": [],
"categories": [],
"popularProducts": [],
"recentlyViewedProducts": [],
"ranges": [],
"error": {
"errorMessage": ""
}
}ID search
ID search
Use this API method if you require only the IDs of the records matching your query. The method also allows you to retrieve facets associated with the search results.
GET
https://<cloudSearchURL>/cloud-search/n-search/idsearch
Query Parameters
- ticketstringrequiredDescription
- termstringrequiredDescription
- svstringrequiredDescription
- paginationStartsFromIntegerDescription
- noOfResultsNumberDescription
- enablePartialSearchBooleanDescription
- categorystringDescription
- enableFiltersBooleanDescription
- enableMultiSelectFiltersBooleanDescription
- applyFiltersstringDescription
- maxNoOfValuesInAFilterIntegerDescription
- sortOrderstringDescription
- showOutOfStockProductsBooleanDescription
- fetchMinMaxPriceBooleanDescription
- priceFieldSuffixstringDescription
- visibilitystringDescription
- resultForZeroIntegerDescription
- recentCategorystringDescription
- noOfResultsZeroIntegerDescription
- optionalFiltersstringDescription
- responseTypestringDescription
- lsqtstringDescription
- flstringDescription
curl
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://eucs15.ksearchnet.com/cloud-search/n-search/idsearch?ticket=klevu-156925593843210765&term=r&sv=20.0.0&paginationStartsFrom=0&noOfResults=2&enablePartialSearch=false&category=KLEVU_PRODUCT&enableFilters=false&enableMultiSelectFilters=false&showOutOfStockProducts=false&responseType=json',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
200
{
"meta": {
"layoutId": "",
"layoutType": "",
"noOfResults": 2,
"paginationStartFrom": 0,
"powerdByLogo": "",
"totalResultsFound": 398,
"typeOfQuery": "WILDCARD_AND",
"storeBaseCurrency": "",
"notificationCode": 1,
"term": "r",
"excludeIds": null,
"isPersonalised": false,
"idsUsedForPersonalisation": null
},
"result": [
{
"id": "31366497206334",
"itemGroupId": "4384059883582"
},
{
"id": "31366455066686",
"itemGroupId": "4384032915518"
}
],
"filters": [],
"price": {
"min": "",
"max": "",
"start": "",
"end": ""
},
"autoComplete": [],
"popularTerm": [],
"pages": [],
"categories": [],
"popularProducts": [],
"recentlyViewedProducts": [],
"ranges": [],
"error": {
"errorMessage": ""
}
}