Create an API key

Creates a new API key with specific permissions and restrictions.

Usage

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

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

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