Class SecuredAPIKeyRestrictions

java.lang.Object
com.algolia.model.search.SecuredAPIKeyRestrictions

public class SecuredAPIKeyRestrictions extends Object
SecuredAPIKeyRestrictions
  • Constructor Details

    • SecuredAPIKeyRestrictions

      public SecuredAPIKeyRestrictions()
  • Method Details

    • setSearchParams

      public SecuredAPIKeyRestrictions setSearchParams(SearchParamsObject searchParams)
    • getSearchParams

      @Nullable public SearchParamsObject getSearchParams()
      Get searchParams
    • setFilters

      public SecuredAPIKeyRestrictions setFilters(String filters)
    • getFilters

      @Nullable public String getFilters()
      Filters that apply to every search made with the secured API key. You can add extra filters at search time with the filters query parameter. For example, if you set the filter group:admin on your generated API key, and you add groups:press OR groups:visitors with the filters query parameter, your final search filter is equivalent to groups:admin AND (groups:press OR groups:visitors).
    • setValidUntil

      public SecuredAPIKeyRestrictions setValidUntil(Long validUntil)
    • getValidUntil

      @Nullable public Long getValidUntil()
      Unix timestamp used to set the expiration date of the API key.
    • setRestrictIndices

      public SecuredAPIKeyRestrictions setRestrictIndices(List<String> restrictIndices)
    • addRestrictIndices

      public SecuredAPIKeyRestrictions addRestrictIndices(String restrictIndicesItem)
    • getRestrictIndices

      @Nullable public List<String> getRestrictIndices()
      Index names that can be queried.
    • setRestrictSources

      public SecuredAPIKeyRestrictions setRestrictSources(String restrictSources)
    • getRestrictSources

      @Nullable public String getRestrictSources()
      IPv4 network allowed to use the generated key. Use this to protect against API key leaking and reuse. You can only provide a single source, but you can specify a range of IPs (for example, 192.168.1.0/24).
    • setUserToken

      public SecuredAPIKeyRestrictions setUserToken(String userToken)
    • getUserToken

      @Nullable public String getUserToken()
      Unique user IP address. This can be useful when you want to impose a rate limit on specific users. By default, rate limits are set based on the IP address. This can become an issue when several users search from the same IP address. To avoid this, you can set a unique userToken for each user when generating their API key. This lets you restrict each user to a maximum number of API calls per hour, even if they share their IP with another user. Specifying the userToken in a secured API key is also a good security practice as it ensures users don't change it. Many features like Analytics, Personalization, and Dynamic Re-ranking rely on the authenticity of user identifiers. Setting the userToken at the API key level ensures that downstream services work as expected and prevents abuse.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object