Create Secured API Key does not work

I am trying to create secured api key but search behavior is not normal as soon as I changed api key to the generated one.
It doesn’t work in Japanese and only shows title and location.
Front end worked well with the different index and the serach only api key.
So I think it not a problem caused by search.addWidgets but I will add capture in the end.!
I don’t see any errors so don’t know how to figure this problem out.

private String generateAlgoliaApiKey(UserInfoBean uib, RicDoorLoginDao ricDoorLoginDao) {

	String applicationKey = ParamUtil.getStringValueFromProperties(
			this.getClass().getResource(ParamConstant.ALGOLIA_PATH), ParamConstant.ALGOLIA_APPLICATION_KEY,

	String adminApiKey = ParamUtil.getStringValueFromProperties(
			this.getClass().getResource(ParamConstant.ALGOLIA_PATH), ParamConstant.ALGOLIA_ADMIN_API_KEY,

	String searchApiKey = ParamUtil.getStringValueFromProperties(
			this.getClass().getResource(ParamConstant.ALGOLIA_PATH), ParamConstant.ALGOLIA_SEARCH_API_KEY,

	String publicKey = "";

	// share stringの生成
	String shareStringList = "shareStringList:";
	String shareString_1 = shareStringList + uib.getProviderId() + "|" + "SM" + Constant.SHARE_MODE_ALL;
	String shareString_2 = shareStringList + uib.getProviderId() + "|" + "SM" + Constant.SHARE_MODE_PRIVATE + "|" + uib.getClientId() + "|" + uib.getAccountId();

	String shareString_3 = shareStringList + uib.getProviderId() + "|" + "SM" + Constant.SHARE_MODE_COMPANY + "|" + uib.getClientId();
	String shareString_4 = shareStringList + uib.getProviderId() + "|" + "SM" + Constant.SHARE_MODE_PROVIDER + "|" + uib.getClientId();

String shareString = shareString_1 + " OR " + shareString_2 + " OR " + shareString_3
+ " OR " + shareString_4;

	// Algolia
	SearchClient client = DefaultSearchClient.create(applicationKey, searchApiKey);

	SecuredApiKeyRestriction restriction = new SecuredApiKeyRestriction()
		//.setQuery(new Query());
		.setQuery(new Query().setFilters(shareString));

	try {
		publicKey = client.generateSecuredAPIKey(searchApiKey, restriction); // A search key that you keep private

	} catch (Exception e1) {

	return publicKey;


Hi @ynaka,
I guess we can look into this issue if we get access to your data.
Could you email us with details to

  • Please visit and provide us with at least 7 days or more of read access.
  • Your AppID
  • Index name
  • A sample parameters you passed to generateSecuredAPIKey, so that we can create a secured api key by ourselves and see if it works or not.

You said

It doesn’t work in Japanese and only shows title and location.

Could you tell us what were supposed to be shown instead of just those two?
Any detailed reproduction steps would be very helpful.

Please send us an email with the information above and a link to this post, so that we can link the email and this thread internally :slight_smile: