Search code examples
algolia

"Not enough rights to add an object" error while implementing Algolia


I'm trying to index contacts in Algolia.
Here is my code:

StreamReader re = File.OpenText("contacts.json");
JsonTextReader reader = new JsonTextReader(re);`
JArray batch = JArray.Load(reader);
// Add objects 
Index index = client.InitIndex("contacts");

index.AddObjects(batch);

I'm getting an error on the last line:

Not enough rights to add an object

Solution

  • It seems like you're using an API key that doesn't have the "Add records" ACL in Algolia.

    You probably used your search API key, when you want to use an API key with write permission to your index, e.g. your Admin API key.