Update an API key

Replaces the permissions of an existing API key.

Any unspecified attribute resets that attribute to its default value.

Usage

Requires Admin API key
1
2
3
4
5
6
7
8
9
import com.algolia.api.SearchClient;
import com.algolia.model.search.*;

SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");

client.updateApiKey(
  "ALGOLIA_API_KEY",
  new ApiKey().setAcl(Arrays.asList(Acl.SEARCH, Acl.ADD_OBJECT)).setValidity(300).setMaxQueriesPerIPPerHour(100).setMaxHitsPerQuery(20)
);
Did you find this page helpful?
Java API clients v4