API error
-
I am getting this below API error if enabled this plugin. How can we fix this. I have enabled “Auto offload new images” “Keep media library structure” “Parse page for images” “Logging” options in the plugin.

-
@venkat01, this is interesting. What’s the error? Can you please expand the 400 Bad Request column?
Best regards,
AntonKindly check the screenshot

@venkat01 , I think the issue is an incorrect API token (or something is blocking the request on your hosting). Please have a look at the detailed setup guide here: https://vcore.au/tutorials/how-to-setup-cloudflare-images-plugin/
Best regards,
Anton@vanyukov When I select “Disconnect from API” to use a different API token, even if I enter incorrect credentials after that, it still connects, and the dashboard appears. I’m not sure if it’s still using the previous API token. Could you please check this?
@venkat01, yeah, the plugin doesn’t verify the validity of the token, there’s no easy way to do that without offloading an image first. The doc I linked explains how to verify that everything is working.
Best regards,
Anton@vanyukov I referred to the doc and followed the below steps, but I’m still encountering an API error in Query Monitor.
- Created an API token as per the doc, copied both the account ID and token, and used it to log in to the plugin.
- Added the account ID and Cloudflare API token to the wp-config.php file.
- In the media library, it displays “Status: Not offloaded Actions.” When I manually attempt to upload to Cloudflare, I receive the following response:
{“success”:false,”errors”:[{“code”:10001,”message”:”Unable to authenticate request”}]}
@venkat01, that means that the token does not have required permissions… for some reason. Do you have Cloudflare Images enabled on your Cloudflare account?
Best regards,
Anton@vanyukov Yes enabled. We are using cloudflare Images already
@vanyukov Tested the API token too using curl and below is the response
status”:”active”},”success”:true,”errors”:[],”messages”:[{“code”:10000,”message”:”This API Token is valid and active”,”type”:null}]}\
Tested for server blockage, and there is none. We are successfully connected to Cloudflare from the server using the same API token. Kindly guide on this
@venkat01 , I’m not sure what else to check, to be honest. You can try logging out in the plugin, and when logging back in check the option to store credentials in the database. And the other option is to verify the key is being stored correctly. Maybe there’s a space or something added when pasting it in?
Best regards,
Anton@vanyukov I think the issue might be related to some file permissions. I want to try starting fresh with new credentials. But, when I delete and reinstall the plugin, it directly shows the dashboard. How can I completely delete all plugin data and start over?
@venkat01 , if the plugin is showing the dashboard, that means that the credentials are either stored in the database or wp-config.php and were not removed, for some reason.
Best regards,
Anton@vanyukov I manually deleted the following rows from the database and removed the CF details from the
wp-config.phpfile:
cf-images-settings, cf-images-version, cf-images-account-id, cf-images-api-tokenI also cleared the plugin cache and the Cloudflare cache. But, even after deleting and reinstalling the plugin, I am still being redirected to the dashboard. Is there anything else I missed? Kindly help.
@venkat01, could you please if you have the
CF_IMAGES_ACCOUNT_IDandCF_IMAGES_KEY_TOKENconstants inwp-config.php? This is the last reason why the dash would show.Best regards,
Anton@vanyukov I deleted the old API token and tried using a new one, and it’s now working. Thanks for your help! But, SVG images are showing as “Unsupported Format” in the offload status and are not being offloaded. Could you please help with this as well?
The topic ‘API error’ is closed to new replies.