Error 403 "This method is only available in HTTPS"

Hi Community,

Happy to be a part of Algolia.

I was trying out the code for adding objects with Javascript onto my existing index,

But i get this error:

 {message: "This method is only available in HTTPS", status:403}

I have checked the credentials twice and it was all okay. can’t figure out where I’m going wrong. Please help.

following is the code i used in JS

var client = algoliasearch("",");
var index = client.initIndex(‘test’);
var objects = [{
objectID: ‘myid1’,
product_name: ‘P1’,
brand_name: ‘E1’

index.addObjects(objects, function(err) {

Please pardon me for silly questions, I am new to algolia.

Thanks and Regards.

1 Like

Hello @aksonsam,

This error means that you can only do admin operation while on a https connection. We enforce this because otherwise people could intercept your admin API key, while it’s going over the network. In all normal instances, this should not be a problem, since if you’re using node to add objects, it will use https by default.

I suggest you do all indexing in a backend operation, not in a browser, because if you allow a user to add objects, they could add arbitrary objects, which is probably not what you want.

So before I can help you further than that, where are you executing this code, and why did you pick that?

Hi Haroen,

Thank you so much for your response. I am following the code mentioned in the document here:

I agree to your point, but for just changing the status or info of one product requiring to add it to new json file and then put in for indexing is all possible and feasible for developer like me , but much less ease of access for my client? isn’t it?
so talking on that perspective I need your help.

I am executing the code in an html file on chrome browser as my project demands to build me a dashboard for the client’s business.

do you have any alternative suggestion?

Appreciate your efforts. Thank you so much…

Hey, so if you’re building an admin dashboard, you clearly need to use the Algolia admin key, and the methods you’re doing are nice. You have two options to make this work:

  1. make a backend that actually does the Algolia changes, and call that from your admin frontend
  2. make sure the admin fronted has https

For the second solution, you can easily get a free https certificate via letsencrypt or cloudflare; does that answer your question?

Hi Haroen,

Thank you very much for the prompt reply.

Just one more doubt, while updating the data, does the number of parameters matters?

for example:
While indexing on bulk load of product info the json file had twenty properties and 10 sub-properties to another five properties
something like this:

‘property1’: ‘random something’,

'property2': 'random something',
'property20': 'random something',
 'property21': ['a','b','c','d','e'],
 'property30' : ['a','b','c','d','e']


but while updating/ adding/deleting is it required for all the fields to be present?

When updating, the complete object is indeed overwritten, but we have partialUpdateObject to update just the fields that are relevant, and not overwriting fields that are already present in the object.

Hi Haroen,

thank you for the prompt reply.

1 Like