Title: Limit the API request
Last modified: January 30, 2024

---

# Limit the API request

 *  Resolved [aurelie44](https://wordpress.org/support/users/aurelie44/)
 * (@aurelie44)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/limit-the-api-request/)
 * Hi,
 * First thanks a lot for this plugin 🙂
   I have just a question : when you are in
   the search bar, the algoria API is called for each letter you type; is it possible
   to limit these calls, and to trigger the search only after a certain number of
   characters (I trigger the search when I have for example at least 3 or 4 characters-
   > call / OR if I do “enter”) because costs increase quickly with this system (
   1 letter = 1 call)Maybe is it possible to add a “hook” for that ?Thanks a lot
 * Aurélie
    -  This topic was modified 2 years, 4 months ago by [aurelie44](https://wordpress.org/support/users/aurelie44/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [2 years, 4 months ago](https://wordpress.org/support/topic/limit-the-api-request/#post-17384434)
 * At least for as long as we’re still using Autocomplete version 0.38.x, then this
   solution should allow for specifying a minLength configuration option.
 * For example, in this highlighted section at [https://github.com/WebDevStudios/wp-search-with-algolia/blob/main/templates/autocomplete.php#L158-L166](https://github.com/WebDevStudios/wp-search-with-algolia/blob/main/templates/autocomplete.php#L158-L166)
 * You’d want to add something like this:
 *     ```wp-block-code
       var config = {
       	minLength: 3,
       	debug: algolia.debug,
       	hint: false,
       	openOnFocus: true,
       	appendTo: 'body',
       	templates: {
       		empty: wp.template( 'autocomplete-empty' )
       	}
       };
       ```
   
 * I put the minLength at the top for easy viewing.
 * You’ll want to copy our autocomplete.php file template into your theme before
   making any changes, so that future updates don’t overwrite your changes. You 
   can see how to do template customizations over at [https://github.com/webDevStudios/wp-search-with-algolia/wiki/Customize-the-Autocomplete-dropdown](https://github.com/webDevStudios/wp-search-with-algolia/wiki/Customize-the-Autocomplete-dropdown)
 *  Thread Starter [aurelie44](https://wordpress.org/support/users/aurelie44/)
 * (@aurelie44)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/limit-the-api-request/#post-17384498)
 * Great !! we will have a look and try it ! thanks for your quick response
   I will
   tell you…
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [2 years, 4 months ago](https://wordpress.org/support/topic/limit-the-api-request/#post-17384548)
 * Welcome.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Limit the API request’ is closed to new replies.

 * ![](https://ps.w.org/wp-search-with-algolia/assets/icon-256x256.png?rev=2894668)
 * [WP Search with Algolia](https://wordpress.org/plugins/wp-search-with-algolia/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-search-with-algolia/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-search-with-algolia/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-search-with-algolia/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-search-with-algolia/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-search-with-algolia/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/limit-the-api-request/#post-17384548)
 * Status: resolved