JSON API
...
Batch Updates
Custom Attributes
8 min
in the swagger/openapi specification docid\ w5ivv5q4jjbffywxds5p8 , you will find that we have some predefined attributes for the item that will not suffice all the use cases, e g you have brand, color, size, etc fields for your product before indexing the additional attributes, the attribute definition needs to be created details of various options are available in the api schema name add custom attribute brand method put url https indexing api ksearchnet com v2 attributes brand description tab examples examples languages id xobgdm4j1d4of8rzlyuhq language json code n label n default brand label n n searchable true n filterable true n returnable true n datatype string n n customlabel request body json selectedlanguageid xobgdm4j1d4of8rzlyuhq results languages id blif1ogwvbqovmu2fclqc language 200 customlabel code n message attribute saved successfully n selectedlanguageid blif1ogwvbqovmu2fclqc request pathparameters queryparameters headerparameters name x klevu auth algo kind required type string description this is the algorithm used to create the security bearer token children name x klevu timestamp kind required type string description this should be your current time while generating the request it is used to keep the request secured and discourage request relays children name x klevu apikey kind required type string description this is the api key of your store please refer to the klevu merchant centre manual to understand where to get this key from children name content type kind required type string description this needs to be application json as this request body contains a json children bodydataparameters formdataparameters currentnewparameter label header parameter value headerparameters name add custom attribute size method put url https indexing api ksearchnet com v2 attributes size description tab examples examples languages id xobgdm4j1d4of8rzlyuhq language json code n label n default size label n n searchable true n filterable true n returnable true n datatype string n customlabel request body json selectedlanguageid xobgdm4j1d4of8rzlyuhq results languages id blif1ogwvbqovmu2fclqc language 200 customlabel code n message attribute saved successfully n selectedlanguageid blif1ogwvbqovmu2fclqc request pathparameters queryparameters headerparameters name x klevu auth algo kind required type string description this is the algorithm used to create the security bearer token children name x klevu timestamp kind required type string description this should be your current time while generating the request it is used to keep the request secured and discourage request relays children name x klevu apikey kind required type string description this is the api key of your store please refer to the klevu merchant centre manual to understand where to get this key from children name content type kind required type string description this needs to be application json as this request body contains a json children bodydataparameters formdataparameters currentnewparameter label header parameter value headerparameters the above api has created two attributes, brand and size important to note that the attribute key should be sanitized, without any special characters this needs to be done only once, not every time you index products for more information on the supported data types, please refer to the data types docid\ ib9ci4foeiffeforoxofo once the attribute definition is created, let's index the product in the above example, we have indexed the two new attributes to the product, i e brand and size example for multivalue attribute registration name add custom attribute materials method put url https indexing api ksearchnet com v2 attributes materials description tab examples examples languages id xobgdm4j1d4of8rzlyuhq language curl code curl location request put https indexing api ksearchnet com v2 attributes custom1 n header x klevu auth algo hmacsha384 n header x klevu timestamp 2023 07 10t08 38 00z n header x klevu apikey klevu 1592574318858490 n header content type application json n header authorization bearer yqvmpq63wosb760eakundomei3rlm efkdg7wexnifewccd6ejqjj5h w hdtfpg n data n label n default materials n n searchable true n filterable false n returnable false n datatype multivalue n customlabel selectedlanguageid xobgdm4j1d4of8rzlyuhq results languages id blif1ogwvbqovmu2fclqc language 200 customlabel code n message attribute saved successfully n selectedlanguageid blif1ogwvbqovmu2fclqc request pathparameters queryparameters headerparameters name x klevu auth algo kind required type string description this is the algorithm used to create the security bearer token children name x klevu timestamp kind required type string description this should be your current time while generating the request it is used to keep the request secured and discourage request relays children name x klevu apikey kind required type string description this is the api key of your store please refer to the klevu merchant centre manual to understand where to get this key from children name content type kind required type string description this needs to be application json as this request body contains a json children name authorization kind required type string description this is the generated security token that authenticates the request children bodydataparameters formdataparameters currentnewparameter label header parameter value headerparameters a sample batch request abbreviate the abbreviations feature allows you to automatically generate shortened forms of values for searchable attributes this can be useful for improving search relevance and efficiency by default, the attributes with key "brand" and "manufacturer are abbreviated to enhance search and retrieval efficiency the abbreviation logic follows these steps initials generation each word in the submitted data is abbreviated to its initials example "larsen & toubro" becomes "l\&t" handling special characters special characters like "&" are replaced with no space example "larsen & toubro" becomes "lt" for a given value "larsen & toubro", the abbreviations generated are l\&t using initials with special characters preserved lt after replacing special characters example name add custom attribute vendor method put url https indexing api ksearchnet com v2 attributes vendor description tab examples examples languages id xobgdm4j1d4of8rzlyuhq language json code n label n default brand label n n searchable true n filterable true n returnable true n abbreviate true n datatype string n n customlabel request body json selectedlanguageid xobgdm4j1d4of8rzlyuhq results languages id blif1ogwvbqovmu2fclqc language 200 customlabel code n message attribute saved successfully n selectedlanguageid blif1ogwvbqovmu2fclqc request pathparameters queryparameters headerparameters name x klevu auth algo kind required type string description this is the algorithm used to create the security bearer token children name x klevu timestamp kind required type string description this should be your current time while generating the request it is used to keep the request secured and discourage request relays children name x klevu apikey kind required type string description this is the api key of your store please refer to the klevu merchant centre manual to understand where to get this key from children name content type kind required type string description this needs to be application json as this request body contains a json children bodydataparameters formdataparameters currentnewparameter label header parameter value headerparameters rangeable this property enhances search flexibility by allowing users to filter data based on numeric ranges, optimizing search and retrieval operations it only works with the attributes that are registered as number or multivalue number as a data type example name add custom attribute length method put url https indexing api ksearchnet com v2 attributes length description tab examples examples languages id xobgdm4j1d4of8rzlyuhq language json code n label n default brand label n n searchable true n filterable true n returnable true n rangeable true n datatype number n n customlabel request body json selectedlanguageid xobgdm4j1d4of8rzlyuhq results languages id blif1ogwvbqovmu2fclqc language 200 customlabel code n message attribute saved successfully n selectedlanguageid blif1ogwvbqovmu2fclqc request pathparameters queryparameters headerparameters name x klevu auth algo kind required type string description this is the algorithm used to create the security bearer token children name x klevu timestamp kind required type string description this should be your current time while generating the request it is used to keep the request secured and discourage request relays children name x klevu apikey kind required type string description this is the api key of your store please refer to the klevu merchant centre manual to understand where to get this key from children name content type kind required type string description this needs to be application json as this request body contains a json children bodydataparameters formdataparameters currentnewparameter label header parameter value headerparameters