Title: Automatic API keys not working
Last modified: December 29, 2023

---

# Automatic API keys not working

 *  Resolved [wpmonitoring](https://wordpress.org/support/users/wpmonitoring/)
 * (@wpmonitoring)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/automatic-api-keys-not-working/)
 * Hi team! We are currently integrating Cleantalk for a couple hundred websites
   but are facing issues with the automated API key retrieval.
 * We have followed the documentation and tried it on 4 websites, but it never works
   correctly. Even when we visit the Cleantalk page, while having put the code below
   in the functions.php of the active theme, the administrator email also doesn’t
   show our email. I’ve pasted the code below for reference. We tested in current
   active theme and our own plugin which is installed on every site, but neither
   work:
 *     ```wp-block-code
       add_filter('apbct_is_get_api_key', function ($_is_get_api_key) {
           return true;
       });
   
       add_filter('apbct_get_api_key_email', function ($_admin_email) {
           return 'X@wpmonitoring.com';
       });
       ```
   
 * Would save a lot of time if we can automatically set these values so we do not
   have to login to each website. I assume when it fetches the API key it will also
   configure itself?

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

 *  Plugin Support [eugenecleantalk](https://wordpress.org/support/users/eugenecleantalk/)
 * (@eugenecleantalk)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/automatic-api-keys-not-working/#post-17308516)
 * Hello [@wpmonitoring](https://wordpress.org/support/users/wpmonitoring/).
 * Pay attention to the notifications on the plugin page after activation. Are there
   any errors?
 * Please note, the code in the active theme to automatically get the Access key
   only works at the moment of plugin activation.
 * Here are the reasons why the plugin may not get the key automatically:
    1. The site is already connected to another CleanTalk account. A notification in
       the plugin will tell you which one. You need to disconnect the site from that
       account. [This guide will help you](https://cleantalk.org/help/add-website#inactive_site).
    2. An Access key was previously issued for the site more than 15 minutes ago. You
       can disconnect the site from the account so that you can get a key again.
    3. Your license does not allow you to connect another site. You need to [upgrade your license](https://cleantalk.org/my/bill/recharge).
    4. The “Policy about adding new sites without authorization” option [in your account settings](https://cleantalk.org/my/profile#profile_options)
       is not set to “On” or “Auto”.
 * After installing the Access Key, the default settings will be set in the plugin.
   You can control the settings using templates. These guides will help you:
    - [https://cleantalk.org/help/plugin-template](https://cleantalk.org/help/plugin-template)
    - [https://cleantalk.org/help/dashboard-template](https://cleantalk.org/help/dashboard-template)
 *  Thread Starter [wpmonitoring](https://wordpress.org/support/users/wpmonitoring/)
 * (@wpmonitoring)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/automatic-api-keys-not-working/#post-17308941)
 * Appreciate the quick response!
 * I tried all these steps however they did not work, we have unlimited sites and
   none of the sites are already connected to another account. Also if the license
   is new (shorter than 15 min ago) the plugin does not get the API keys.
 * What worked for me was enabling the “Policy about adding new sites without authorization”.
   I don’t know if this is a good permanent solution though.
 * I tried on about 10 sites, and these symptoms occur on any site.
 *  Thread Starter [wpmonitoring](https://wordpress.org/support/users/wpmonitoring/)
 * (@wpmonitoring)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/automatic-api-keys-not-working/#post-17308948)
 * Additionally it doesn’t always work even with this enabled. Neither when I paste
   the code in the theme or our custom plugin.
 * Is there a specific action or hook we could tap into instead, or any other automated
   solution?
 *  Plugin Support [eugenecleantalk](https://wordpress.org/support/users/eugenecleantalk/)
 * (@eugenecleantalk)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/automatic-api-keys-not-working/#post-17308957)
 * There is an alternative option using the API. Here’s the guide: [https://cleantalk.org/help/get-api-key](https://cleantalk.org/help/get-api-key).
 * The article has not been completed yet. Requests should be sent to api.cleantalk.
   org.
 *  Thread Starter [wpmonitoring](https://wordpress.org/support/users/wpmonitoring/)
 * (@wpmonitoring)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/automatic-api-keys-not-working/#post-17308965)
 * Could you provide some more information on this?
 * Also we can even inject the API key directly into the Cleantalk WordPress table
   if that is what is needed. Or maybe use a method from the Cleantalk class directly.
   Since we develop our plugin in-house we can make any adjustments as needed to
   make this work.
 * Please advise what the best steps are. We are building this for automated deployment;
   so that Cleantalk gets installed for every new site added, so automating this
   process would be very helpful.
 *  Plugin Support [eugenecleantalk](https://wordpress.org/support/users/eugenecleantalk/)
 * (@eugenecleantalk)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/automatic-api-keys-not-working/#post-17309010)
 * > Also we can even inject the API key directly into the Cleantalk WordPress table
   > if that is what is needed. Or maybe use a method from the Cleantalk class directly.
 * I don’t think this is the solution.
 * > Could you provide some more information on this?
 * To get an access key, you need to send a POST request to our server with the 
   parameters specified in the guide.
 * If you are having difficulties in getting the key via a hook in an active theme,
   we can investigate your case. Please contact us via our private Ticket System
   and add there a link to this topic: [https://cleantalk.org/my/support/open](https://cleantalk.org/my/support/open).
 *  Plugin Support [katereji](https://wordpress.org/support/users/katereji/)
 * (@katereji)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/automatic-api-keys-not-working/#post-17348671)
 * Hello.
   We haven’t heard back from you in a few days, so I’m going to mark this
   thread as “resolved”.If you have any further questions, you can start a new thread
   or contact us via our private Ticket System: [https://cleantalk.org/my/support/open](https://cleantalk.org/my/support/open).

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

The topic ‘Automatic API keys not working’ is closed to new replies.

 * ![](https://ps.w.org/cleantalk-spam-protect/assets/icon-256x256.gif?rev=3539767)
 * [Anti-Spam by CleanTalk. Spam Firewall & protection](https://wordpress.org/plugins/cleantalk-spam-protect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cleantalk-spam-protect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cleantalk-spam-protect/)
 * [Active Topics](https://wordpress.org/support/plugin/cleantalk-spam-protect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cleantalk-spam-protect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [katereji](https://wordpress.org/support/users/katereji/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/automatic-api-keys-not-working/#post-17348671)
 * Status: resolved